@astrasyncai/verification-gateway 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +213 -0
  2. package/dist/adapters/express.d.mts +3 -0
  3. package/dist/adapters/express.d.ts +3 -0
  4. package/dist/adapters/express.js +516 -0
  5. package/dist/adapters/express.js.map +1 -0
  6. package/dist/adapters/express.mjs +486 -0
  7. package/dist/adapters/express.mjs.map +1 -0
  8. package/dist/adapters/nextjs.d.mts +3 -0
  9. package/dist/adapters/nextjs.d.ts +3 -0
  10. package/dist/adapters/nextjs.js +624 -0
  11. package/dist/adapters/nextjs.js.map +1 -0
  12. package/dist/adapters/nextjs.mjs +586 -0
  13. package/dist/adapters/nextjs.mjs.map +1 -0
  14. package/dist/adapters/sdk.d.mts +2 -0
  15. package/dist/adapters/sdk.d.ts +2 -0
  16. package/dist/adapters/sdk.js +505 -0
  17. package/dist/adapters/sdk.js.map +1 -0
  18. package/dist/adapters/sdk.mjs +473 -0
  19. package/dist/adapters/sdk.mjs.map +1 -0
  20. package/dist/express-BhD3mWsL.d.ts +64 -0
  21. package/dist/express-DUDYpvNZ.d.mts +64 -0
  22. package/dist/index.d.mts +353 -0
  23. package/dist/index.d.ts +353 -0
  24. package/dist/index.js +1499 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/index.mjs +1446 -0
  27. package/dist/index.mjs.map +1 -0
  28. package/dist/nextjs-BtqyLSVQ.d.mts +22 -0
  29. package/dist/nextjs-C9FPOjSh.d.ts +22 -0
  30. package/dist/sdk-BkVigGjF.d.ts +190 -0
  31. package/dist/sdk-xCbZgeZx.d.mts +190 -0
  32. package/dist/types-CS6v75-d.d.mts +359 -0
  33. package/dist/types-CS6v75-d.d.ts +359 -0
  34. package/dist/ui/index.d.mts +140 -0
  35. package/dist/ui/index.d.ts +140 -0
  36. package/dist/ui/index.js +826 -0
  37. package/dist/ui/index.js.map +1 -0
  38. package/dist/ui/index.mjs +782 -0
  39. package/dist/ui/index.mjs.map +1 -0
  40. package/package.json +89 -0
@@ -0,0 +1,826 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/ui/index.ts
31
+ var ui_exports = {};
32
+ __export(ui_exports, {
33
+ AccessLevelIndicator: () => AccessLevelIndicator,
34
+ CommerceShield: () => CommerceShield,
35
+ CredentialPrompt: () => CredentialPrompt,
36
+ DenialReasons: () => DenialReasons,
37
+ GuidanceCard: () => GuidanceCard,
38
+ TrustLevelBadge: () => TrustLevelBadge,
39
+ useCommerceShield: () => useCommerceShield,
40
+ useCredentialPrompt: () => useCredentialPrompt
41
+ });
42
+ module.exports = __toCommonJS(ui_exports);
43
+
44
+ // src/ui/commerce-shield.tsx
45
+ var import_react = __toESM(require("react"));
46
+ var import_jsx_runtime = require("react/jsx-runtime");
47
+ var defaultStyles = {
48
+ overlay: {
49
+ position: "fixed",
50
+ top: 0,
51
+ left: 0,
52
+ right: 0,
53
+ bottom: 0,
54
+ backgroundColor: "rgba(26, 26, 46, 0.95)",
55
+ display: "flex",
56
+ alignItems: "center",
57
+ justifyContent: "center",
58
+ zIndex: 9999,
59
+ padding: "20px"
60
+ },
61
+ container: {
62
+ backgroundColor: "rgba(255, 255, 255, 0.95)",
63
+ borderRadius: "16px",
64
+ boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.5)",
65
+ maxWidth: "480px",
66
+ width: "100%",
67
+ padding: "40px",
68
+ textAlign: "center"
69
+ },
70
+ icon: {
71
+ fontSize: "48px",
72
+ marginBottom: "20px"
73
+ },
74
+ title: {
75
+ fontSize: "24px",
76
+ fontWeight: 700,
77
+ color: "#1a1a2e",
78
+ marginBottom: "16px"
79
+ },
80
+ message: {
81
+ color: "#4a5568",
82
+ lineHeight: 1.6,
83
+ marginBottom: "24px"
84
+ },
85
+ stepsContainer: {
86
+ textAlign: "left",
87
+ backgroundColor: "#f7fafc",
88
+ borderRadius: "8px",
89
+ padding: "20px",
90
+ marginBottom: "24px"
91
+ },
92
+ stepsTitle: {
93
+ fontSize: "14px",
94
+ fontWeight: 600,
95
+ color: "#2d3748",
96
+ marginBottom: "12px"
97
+ },
98
+ stepsList: {
99
+ paddingLeft: "20px",
100
+ color: "#4a5568",
101
+ margin: 0
102
+ },
103
+ stepItem: {
104
+ marginBottom: "8px"
105
+ },
106
+ buttonsContainer: {
107
+ display: "flex",
108
+ flexDirection: "column",
109
+ gap: "12px"
110
+ },
111
+ buttonBase: {
112
+ display: "inline-block",
113
+ padding: "14px 24px",
114
+ borderRadius: "8px",
115
+ fontWeight: 600,
116
+ textDecoration: "none",
117
+ cursor: "pointer",
118
+ border: "none",
119
+ fontSize: "16px",
120
+ transition: "all 0.2s"
121
+ },
122
+ buttonPrimary: {
123
+ background: "linear-gradient(135deg, #6366f1 0%, #4f46e5 100%)",
124
+ color: "white"
125
+ },
126
+ buttonSecondary: {
127
+ backgroundColor: "#e2e8f0",
128
+ color: "#4a5568"
129
+ },
130
+ footer: {
131
+ marginTop: "24px",
132
+ fontSize: "14px",
133
+ color: "#718096"
134
+ },
135
+ footerLink: {
136
+ color: "#6366f1",
137
+ textDecoration: "none"
138
+ }
139
+ };
140
+ function CommerceShield({
141
+ visible,
142
+ result,
143
+ onRegister,
144
+ onGuestAccess,
145
+ onDismiss,
146
+ title = "AstraSync Agent Verification",
147
+ message,
148
+ allowGuestAccess = true,
149
+ className
150
+ }) {
151
+ if (!visible) {
152
+ return null;
153
+ }
154
+ const displayMessage = message || result?.guidance?.message || "This site verifies AI agents before granting access. We noticed you're visiting without AstraSync credentials.";
155
+ const registrationUrl = result?.guidance?.registrationUrl || "https://astrasync.ai/register";
156
+ const docsUrl = result?.guidance?.documentationUrl || "https://astrasync.ai/docs/agent-access";
157
+ const steps = result?.guidance?.steps || [
158
+ "Register at astrasync.ai/register",
159
+ "Create and register your agent",
160
+ "Add your ASTRA-ID to request headers",
161
+ "Refresh this page"
162
+ ];
163
+ const handleRegisterClick = () => {
164
+ if (onRegister) {
165
+ onRegister();
166
+ } else {
167
+ window.location.href = registrationUrl;
168
+ }
169
+ };
170
+ const handleGuestClick = () => {
171
+ if (onGuestAccess) {
172
+ onGuestAccess();
173
+ } else if (onDismiss) {
174
+ onDismiss();
175
+ }
176
+ };
177
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
178
+ "div",
179
+ {
180
+ style: defaultStyles.overlay,
181
+ className,
182
+ role: "dialog",
183
+ "aria-modal": "true",
184
+ "aria-labelledby": "commerce-shield-title",
185
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: defaultStyles.container, children: [
186
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: defaultStyles.icon, "aria-hidden": "true", children: "\u{1F6E1}\uFE0F" }),
187
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { id: "commerce-shield-title", style: defaultStyles.title, children: title }),
188
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { style: defaultStyles.message, children: displayMessage }),
189
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: defaultStyles.stepsContainer, children: [
190
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { style: defaultStyles.stepsTitle, children: "To get verified access:" }),
191
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { style: defaultStyles.stepsList, children: steps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { style: defaultStyles.stepItem, children: step }, index)) })
192
+ ] }),
193
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: defaultStyles.buttonsContainer, children: [
194
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
195
+ "button",
196
+ {
197
+ onClick: handleRegisterClick,
198
+ style: { ...defaultStyles.buttonBase, ...defaultStyles.buttonPrimary },
199
+ children: "Register Now"
200
+ }
201
+ ),
202
+ allowGuestAccess && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
203
+ "button",
204
+ {
205
+ onClick: handleGuestClick,
206
+ style: { ...defaultStyles.buttonBase, ...defaultStyles.buttonSecondary },
207
+ children: "Continue as Guest (Limited)"
208
+ }
209
+ )
210
+ ] }),
211
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { style: defaultStyles.footer, children: [
212
+ "Learn more:",
213
+ " ",
214
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
215
+ "a",
216
+ {
217
+ href: docsUrl,
218
+ style: defaultStyles.footerLink,
219
+ target: "_blank",
220
+ rel: "noopener noreferrer",
221
+ children: "Agent Access Documentation"
222
+ }
223
+ )
224
+ ] })
225
+ ] })
226
+ }
227
+ );
228
+ }
229
+ function useCommerceShield(verificationResult) {
230
+ const [visible, setVisible] = import_react.default.useState(false);
231
+ const [dismissed, setDismissed] = import_react.default.useState(false);
232
+ import_react.default.useEffect(() => {
233
+ if (verificationResult && !dismissed) {
234
+ const shouldShow = !verificationResult.verified || verificationResult.accessLevel === "none" || verificationResult.accessLevel === "guidance";
235
+ setVisible(shouldShow);
236
+ }
237
+ }, [verificationResult, dismissed]);
238
+ const dismiss = import_react.default.useCallback(() => {
239
+ setDismissed(true);
240
+ setVisible(false);
241
+ }, []);
242
+ const reset = import_react.default.useCallback(() => {
243
+ setDismissed(false);
244
+ }, []);
245
+ return {
246
+ visible,
247
+ dismiss,
248
+ reset,
249
+ result: verificationResult
250
+ };
251
+ }
252
+
253
+ // src/ui/credential-prompt.tsx
254
+ var import_react2 = require("react");
255
+ var import_jsx_runtime2 = require("react/jsx-runtime");
256
+ var defaultStyles2 = {
257
+ overlay: {
258
+ position: "fixed",
259
+ top: 0,
260
+ left: 0,
261
+ right: 0,
262
+ bottom: 0,
263
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
264
+ display: "flex",
265
+ alignItems: "center",
266
+ justifyContent: "center",
267
+ zIndex: 9999,
268
+ padding: "20px"
269
+ },
270
+ container: {
271
+ backgroundColor: "white",
272
+ borderRadius: "12px",
273
+ boxShadow: "0 20px 40px rgba(0, 0, 0, 0.3)",
274
+ maxWidth: "400px",
275
+ width: "100%",
276
+ padding: "32px"
277
+ },
278
+ title: {
279
+ fontSize: "20px",
280
+ fontWeight: 600,
281
+ color: "#1a1a2e",
282
+ marginBottom: "8px"
283
+ },
284
+ description: {
285
+ fontSize: "14px",
286
+ color: "#64748b",
287
+ marginBottom: "24px",
288
+ lineHeight: 1.5
289
+ },
290
+ form: {
291
+ display: "flex",
292
+ flexDirection: "column",
293
+ gap: "16px"
294
+ },
295
+ inputGroup: {
296
+ display: "flex",
297
+ flexDirection: "column",
298
+ gap: "6px"
299
+ },
300
+ label: {
301
+ fontSize: "14px",
302
+ fontWeight: 500,
303
+ color: "#374151"
304
+ },
305
+ input: {
306
+ padding: "12px",
307
+ borderRadius: "8px",
308
+ border: "1px solid #d1d5db",
309
+ fontSize: "14px",
310
+ outline: "none",
311
+ transition: "border-color 0.2s"
312
+ },
313
+ error: {
314
+ backgroundColor: "#fef2f2",
315
+ color: "#dc2626",
316
+ padding: "12px",
317
+ borderRadius: "8px",
318
+ fontSize: "14px",
319
+ marginBottom: "16px"
320
+ },
321
+ buttonContainer: {
322
+ display: "flex",
323
+ gap: "12px",
324
+ marginTop: "8px"
325
+ },
326
+ button: {
327
+ flex: 1,
328
+ padding: "12px 16px",
329
+ borderRadius: "8px",
330
+ fontWeight: 600,
331
+ fontSize: "14px",
332
+ cursor: "pointer",
333
+ transition: "all 0.2s",
334
+ border: "none"
335
+ },
336
+ buttonPrimary: {
337
+ backgroundColor: "#4f46e5",
338
+ color: "white"
339
+ },
340
+ buttonSecondary: {
341
+ backgroundColor: "#f1f5f9",
342
+ color: "#475569"
343
+ },
344
+ buttonDisabled: {
345
+ opacity: 0.5,
346
+ cursor: "not-allowed"
347
+ }
348
+ };
349
+ function CredentialPrompt({
350
+ visible,
351
+ onSubmit,
352
+ onDismiss,
353
+ title = "Enter Agent Credentials",
354
+ description = "Provide your AstraSync agent credentials to verify your identity.",
355
+ showApiKey = true,
356
+ showJwt = false,
357
+ loading = false,
358
+ error,
359
+ className
360
+ }) {
361
+ const [astraId, setAstraId] = (0, import_react2.useState)("");
362
+ const [apiKey, setApiKey] = (0, import_react2.useState)("");
363
+ const [jwt, setJwt] = (0, import_react2.useState)("");
364
+ const handleSubmit = (0, import_react2.useCallback)((e) => {
365
+ e.preventDefault();
366
+ const credentials = {};
367
+ if (astraId.trim()) {
368
+ credentials.astraId = astraId.trim();
369
+ }
370
+ if (apiKey.trim()) {
371
+ credentials.apiKey = apiKey.trim();
372
+ }
373
+ if (jwt.trim()) {
374
+ credentials.jwt = jwt.trim();
375
+ }
376
+ onSubmit(credentials);
377
+ }, [astraId, apiKey, jwt, onSubmit]);
378
+ const handleKeyDown = (0, import_react2.useCallback)((e) => {
379
+ if (e.key === "Escape" && onDismiss) {
380
+ onDismiss();
381
+ }
382
+ }, [onDismiss]);
383
+ if (!visible) {
384
+ return null;
385
+ }
386
+ const isValid = astraId.trim() || apiKey.trim() || jwt.trim();
387
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
388
+ "div",
389
+ {
390
+ style: defaultStyles2.overlay,
391
+ className,
392
+ role: "dialog",
393
+ "aria-modal": "true",
394
+ "aria-labelledby": "credential-prompt-title",
395
+ onKeyDown: handleKeyDown,
396
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: defaultStyles2.container, children: [
397
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { id: "credential-prompt-title", style: defaultStyles2.title, children: title }),
398
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { style: defaultStyles2.description, children: description }),
399
+ error && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: defaultStyles2.error, role: "alert", children: error }),
400
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("form", { onSubmit: handleSubmit, style: defaultStyles2.form, children: [
401
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: defaultStyles2.inputGroup, children: [
402
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: "astra-id", style: defaultStyles2.label, children: "ASTRA-ID" }),
403
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
404
+ "input",
405
+ {
406
+ id: "astra-id",
407
+ type: "text",
408
+ value: astraId,
409
+ onChange: (e) => setAstraId(e.target.value),
410
+ placeholder: "ASTRA-xxx or ASTRAD-xxx",
411
+ style: defaultStyles2.input,
412
+ disabled: loading
413
+ }
414
+ )
415
+ ] }),
416
+ showApiKey && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: defaultStyles2.inputGroup, children: [
417
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: "api-key", style: defaultStyles2.label, children: "API Key (optional)" }),
418
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
419
+ "input",
420
+ {
421
+ id: "api-key",
422
+ type: "password",
423
+ value: apiKey,
424
+ onChange: (e) => setApiKey(e.target.value),
425
+ placeholder: "Your API key",
426
+ style: defaultStyles2.input,
427
+ disabled: loading
428
+ }
429
+ )
430
+ ] }),
431
+ showJwt && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: defaultStyles2.inputGroup, children: [
432
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: "jwt", style: defaultStyles2.label, children: "JWT Token (optional)" }),
433
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
434
+ "input",
435
+ {
436
+ id: "jwt",
437
+ type: "password",
438
+ value: jwt,
439
+ onChange: (e) => setJwt(e.target.value),
440
+ placeholder: "Your JWT token",
441
+ style: defaultStyles2.input,
442
+ disabled: loading
443
+ }
444
+ )
445
+ ] }),
446
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: defaultStyles2.buttonContainer, children: [
447
+ onDismiss && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
448
+ "button",
449
+ {
450
+ type: "button",
451
+ onClick: onDismiss,
452
+ style: { ...defaultStyles2.button, ...defaultStyles2.buttonSecondary },
453
+ disabled: loading,
454
+ children: "Cancel"
455
+ }
456
+ ),
457
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
458
+ "button",
459
+ {
460
+ type: "submit",
461
+ style: {
462
+ ...defaultStyles2.button,
463
+ ...defaultStyles2.buttonPrimary,
464
+ ...!isValid || loading ? defaultStyles2.buttonDisabled : {}
465
+ },
466
+ disabled: !isValid || loading,
467
+ children: loading ? "Verifying..." : "Verify"
468
+ }
469
+ )
470
+ ] })
471
+ ] })
472
+ ] })
473
+ }
474
+ );
475
+ }
476
+ function useCredentialPrompt() {
477
+ const [visible, setVisible] = (0, import_react2.useState)(false);
478
+ const [credentials, setCredentials] = (0, import_react2.useState)(null);
479
+ const [loading, setLoading] = (0, import_react2.useState)(false);
480
+ const [error, setError] = (0, import_react2.useState)(null);
481
+ const show = (0, import_react2.useCallback)(() => {
482
+ setVisible(true);
483
+ setError(null);
484
+ }, []);
485
+ const hide = (0, import_react2.useCallback)(() => {
486
+ setVisible(false);
487
+ setError(null);
488
+ setLoading(false);
489
+ }, []);
490
+ const submit = (0, import_react2.useCallback)((creds) => {
491
+ setCredentials(creds);
492
+ setLoading(true);
493
+ setError(null);
494
+ }, []);
495
+ const setSubmitError = (0, import_react2.useCallback)((err) => {
496
+ setError(err);
497
+ setLoading(false);
498
+ }, []);
499
+ const complete = (0, import_react2.useCallback)(() => {
500
+ setVisible(false);
501
+ setLoading(false);
502
+ setError(null);
503
+ }, []);
504
+ return {
505
+ visible,
506
+ credentials,
507
+ loading,
508
+ error,
509
+ show,
510
+ hide,
511
+ submit,
512
+ setError: setSubmitError,
513
+ complete
514
+ };
515
+ }
516
+
517
+ // src/ui/guidance.tsx
518
+ var import_jsx_runtime3 = require("react/jsx-runtime");
519
+ var styles = {
520
+ card: {
521
+ backgroundColor: "#f8fafc",
522
+ border: "1px solid #e2e8f0",
523
+ borderRadius: "12px",
524
+ padding: "24px",
525
+ maxWidth: "480px"
526
+ },
527
+ cardCompact: {
528
+ backgroundColor: "#fefce8",
529
+ border: "1px solid #fef08a",
530
+ borderRadius: "8px",
531
+ padding: "16px"
532
+ },
533
+ cardTitle: {
534
+ fontSize: "18px",
535
+ fontWeight: 600,
536
+ color: "#1e293b",
537
+ marginBottom: "12px",
538
+ display: "flex",
539
+ alignItems: "center",
540
+ gap: "8px"
541
+ },
542
+ cardMessage: {
543
+ fontSize: "14px",
544
+ color: "#475569",
545
+ lineHeight: 1.6,
546
+ marginBottom: "16px"
547
+ },
548
+ stepsList: {
549
+ listStyle: "none",
550
+ padding: 0,
551
+ margin: 0
552
+ },
553
+ stepItem: {
554
+ display: "flex",
555
+ alignItems: "flex-start",
556
+ gap: "12px",
557
+ marginBottom: "12px",
558
+ fontSize: "14px",
559
+ color: "#334155"
560
+ },
561
+ stepNumber: {
562
+ backgroundColor: "#e0e7ff",
563
+ color: "#4338ca",
564
+ width: "24px",
565
+ height: "24px",
566
+ borderRadius: "50%",
567
+ display: "flex",
568
+ alignItems: "center",
569
+ justifyContent: "center",
570
+ fontSize: "12px",
571
+ fontWeight: 600,
572
+ flexShrink: 0
573
+ },
574
+ links: {
575
+ display: "flex",
576
+ gap: "16px",
577
+ marginTop: "16px",
578
+ paddingTop: "16px",
579
+ borderTop: "1px solid #e2e8f0"
580
+ },
581
+ link: {
582
+ color: "#4f46e5",
583
+ textDecoration: "none",
584
+ fontSize: "14px",
585
+ fontWeight: 500
586
+ },
587
+ badge: {
588
+ display: "inline-flex",
589
+ alignItems: "center",
590
+ gap: "4px",
591
+ padding: "4px 8px",
592
+ borderRadius: "9999px",
593
+ fontWeight: 600,
594
+ fontSize: "12px"
595
+ },
596
+ badgeSm: {
597
+ padding: "2px 6px",
598
+ fontSize: "10px"
599
+ },
600
+ badgeLg: {
601
+ padding: "6px 12px",
602
+ fontSize: "14px"
603
+ },
604
+ badgeBronze: {
605
+ backgroundColor: "#fef3c7",
606
+ color: "#92400e"
607
+ },
608
+ badgeSilver: {
609
+ backgroundColor: "#e5e7eb",
610
+ color: "#374151"
611
+ },
612
+ badgeGold: {
613
+ backgroundColor: "#fef9c3",
614
+ color: "#854d0e"
615
+ },
616
+ badgePlatinum: {
617
+ backgroundColor: "#e0e7ff",
618
+ color: "#3730a3"
619
+ },
620
+ indicator: {
621
+ display: "flex",
622
+ alignItems: "center",
623
+ gap: "8px",
624
+ fontSize: "14px"
625
+ },
626
+ indicatorDot: {
627
+ width: "8px",
628
+ height: "8px",
629
+ borderRadius: "50%"
630
+ },
631
+ indicatorAllowed: {
632
+ backgroundColor: "#22c55e"
633
+ },
634
+ indicatorDenied: {
635
+ backgroundColor: "#ef4444"
636
+ },
637
+ indicatorLimited: {
638
+ backgroundColor: "#f59e0b"
639
+ }
640
+ };
641
+ function GuidanceCard({
642
+ guidance,
643
+ title = "How to Get Verified",
644
+ compact = false,
645
+ className
646
+ }) {
647
+ const cardStyle = compact ? styles.cardCompact : styles.card;
648
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: cardStyle, className, children: [
649
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("h3", { style: styles.cardTitle, children: [
650
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u{1F4A1}" }),
651
+ title
652
+ ] }),
653
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { style: styles.cardMessage, children: guidance.message }),
654
+ guidance.steps && guidance.steps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ol", { style: styles.stepsList, children: guidance.steps.map((step, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("li", { style: styles.stepItem, children: [
655
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: styles.stepNumber, children: index + 1 }),
656
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: step })
657
+ ] }, index)) }),
658
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: styles.links, children: [
659
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
660
+ "a",
661
+ {
662
+ href: guidance.registrationUrl,
663
+ style: styles.link,
664
+ target: "_blank",
665
+ rel: "noopener noreferrer",
666
+ children: "Register \u2192"
667
+ }
668
+ ),
669
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
670
+ "a",
671
+ {
672
+ href: guidance.documentationUrl,
673
+ style: styles.link,
674
+ target: "_blank",
675
+ rel: "noopener noreferrer",
676
+ children: "Documentation \u2192"
677
+ }
678
+ )
679
+ ] })
680
+ ] });
681
+ }
682
+ function TrustLevelBadge({
683
+ level,
684
+ score,
685
+ size = "md",
686
+ className
687
+ }) {
688
+ const levelColors = {
689
+ BRONZE: styles.badgeBronze,
690
+ SILVER: styles.badgeSilver,
691
+ GOLD: styles.badgeGold,
692
+ PLATINUM: styles.badgePlatinum
693
+ };
694
+ const sizeStyles = {
695
+ sm: styles.badgeSm,
696
+ md: {},
697
+ lg: styles.badgeLg
698
+ };
699
+ const levelEmojis = {
700
+ BRONZE: "\u{1F949}",
701
+ SILVER: "\u{1F948}",
702
+ GOLD: "\u{1F947}",
703
+ PLATINUM: "\u{1F48E}"
704
+ };
705
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
706
+ "span",
707
+ {
708
+ style: {
709
+ ...styles.badge,
710
+ ...levelColors[level],
711
+ ...sizeStyles[size]
712
+ },
713
+ className,
714
+ children: [
715
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: levelEmojis[level] }),
716
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: level }),
717
+ score !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
718
+ "(",
719
+ score,
720
+ ")"
721
+ ] })
722
+ ]
723
+ }
724
+ );
725
+ }
726
+ function AccessLevelIndicator({
727
+ accessLevel,
728
+ requiredLevel,
729
+ className
730
+ }) {
731
+ const getStatus = () => {
732
+ if (accessLevel === "none" || accessLevel === "guidance") {
733
+ return "denied";
734
+ }
735
+ if (requiredLevel) {
736
+ const levels = ["none", "guidance", "read-only", "standard", "full", "internal"];
737
+ const currentIndex = levels.indexOf(accessLevel);
738
+ const requiredIndex = levels.indexOf(requiredLevel);
739
+ if (currentIndex < requiredIndex) {
740
+ return "limited";
741
+ }
742
+ }
743
+ return "allowed";
744
+ };
745
+ const status = getStatus();
746
+ const statusColors = {
747
+ allowed: styles.indicatorAllowed,
748
+ denied: styles.indicatorDenied,
749
+ limited: styles.indicatorLimited
750
+ };
751
+ const statusLabels = {
752
+ allowed: "Access Granted",
753
+ denied: "Access Denied",
754
+ limited: "Limited Access"
755
+ };
756
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: styles.indicator, className, children: [
757
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { ...styles.indicatorDot, ...statusColors[status] } }),
758
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: statusLabels[status] }),
759
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { style: { color: "#94a3b8" }, children: [
760
+ "(",
761
+ accessLevel,
762
+ ")"
763
+ ] })
764
+ ] });
765
+ }
766
+ function DenialReasons({ reasons, className }) {
767
+ if (reasons.length === 0) {
768
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {});
769
+ }
770
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
771
+ "div",
772
+ {
773
+ style: {
774
+ backgroundColor: "#fef2f2",
775
+ border: "1px solid #fecaca",
776
+ borderRadius: "8px",
777
+ padding: "16px"
778
+ },
779
+ className,
780
+ children: [
781
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
782
+ "h4",
783
+ {
784
+ style: {
785
+ fontSize: "14px",
786
+ fontWeight: 600,
787
+ color: "#dc2626",
788
+ marginBottom: "8px",
789
+ display: "flex",
790
+ alignItems: "center",
791
+ gap: "6px"
792
+ },
793
+ children: [
794
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u26A0\uFE0F" }),
795
+ "Access Denied"
796
+ ]
797
+ }
798
+ ),
799
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
800
+ "ul",
801
+ {
802
+ style: {
803
+ margin: 0,
804
+ paddingLeft: "20px",
805
+ color: "#991b1b",
806
+ fontSize: "14px"
807
+ },
808
+ children: reasons.map((reason, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { style: { marginBottom: "4px" }, children: reason }, index))
809
+ }
810
+ )
811
+ ]
812
+ }
813
+ );
814
+ }
815
+ // Annotate the CommonJS export names for ESM import in node:
816
+ 0 && (module.exports = {
817
+ AccessLevelIndicator,
818
+ CommerceShield,
819
+ CredentialPrompt,
820
+ DenialReasons,
821
+ GuidanceCard,
822
+ TrustLevelBadge,
823
+ useCommerceShield,
824
+ useCredentialPrompt
825
+ });
826
+ //# sourceMappingURL=index.js.map