@tetsuo-ai/marketplace-react 0.4.0 → 0.5.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 (88) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +93 -47
  3. package/dist/chunk-7NKRSPPN.js +227 -0
  4. package/dist/chunk-7NKRSPPN.js.map +1 -0
  5. package/dist/{chunk-BNILOX3O.js → chunk-CDDHUFMG.js} +38 -6
  6. package/dist/chunk-CDDHUFMG.js.map +1 -0
  7. package/dist/chunk-FIDFPM5A.cjs +40 -0
  8. package/dist/chunk-FIDFPM5A.cjs.map +1 -0
  9. package/dist/chunk-IJKWKY4H.cjs +1370 -0
  10. package/dist/chunk-IJKWKY4H.cjs.map +1 -0
  11. package/dist/chunk-JTSG5FGC.cjs +397 -0
  12. package/dist/chunk-JTSG5FGC.cjs.map +1 -0
  13. package/dist/chunk-ONC6L3IX.cjs +97 -0
  14. package/dist/chunk-ONC6L3IX.cjs.map +1 -0
  15. package/dist/chunk-R76EUYDI.cjs +233 -0
  16. package/dist/chunk-R76EUYDI.cjs.map +1 -0
  17. package/dist/chunk-RG5JZ6JL.js +378 -0
  18. package/dist/chunk-RG5JZ6JL.js.map +1 -0
  19. package/dist/components/index.cjs +158 -1513
  20. package/dist/components/index.cjs.map +1 -1
  21. package/dist/components/index.d.cts +2 -2
  22. package/dist/components/index.d.ts +2 -2
  23. package/dist/components/index.js +2 -2
  24. package/dist/hooks/index.cjs +693 -457
  25. package/dist/hooks/index.cjs.map +1 -1
  26. package/dist/hooks/index.d.cts +109 -28
  27. package/dist/hooks/index.d.ts +109 -28
  28. package/dist/hooks/index.js +659 -178
  29. package/dist/hooks/index.js.map +1 -1
  30. package/dist/{index-DQ3Xovkq.d.ts → index-BAyr1ODZ.d.ts} +76 -6
  31. package/dist/{index-UxuvIlmD.d.cts → index-C20NVU7_.d.cts} +76 -6
  32. package/dist/index.cjs +284 -1752
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.cts +7 -8
  35. package/dist/index.d.ts +7 -8
  36. package/dist/index.js +64 -4
  37. package/dist/index.js.map +1 -1
  38. package/dist/signers/index.cjs +22 -161
  39. package/dist/signers/index.cjs.map +1 -1
  40. package/dist/signers/index.d.cts +16 -11
  41. package/dist/signers/index.d.ts +16 -11
  42. package/dist/signers/index.js +1 -1
  43. package/dist/testing/index.d.cts +1 -1
  44. package/dist/testing/index.d.ts +1 -1
  45. package/dist/theme/agenc-tailwind-preset.cjs +134 -108
  46. package/dist/{types-jvISR6bc.d.cts → types-B10rndEI.d.cts} +16 -7
  47. package/dist/{types-jvISR6bc.d.ts → types-B10rndEI.d.ts} +16 -7
  48. package/dist/{useAgentTrackRecord-BCvRHYM2.d.cts → useAgentTrackRecord-Ch7gHTFj.d.cts} +40 -3
  49. package/dist/{useAgentTrackRecord-BCvRHYM2.d.ts → useAgentTrackRecord-Ch7gHTFj.d.ts} +40 -3
  50. package/package.json +6 -3
  51. package/src/components/GuaranteedBadge.tsx +73 -0
  52. package/src/components/HireCheckoutModal.tsx +5 -2
  53. package/src/components/index.ts +4 -0
  54. package/src/components/strings.ts +8 -0
  55. package/src/hooks/index.ts +14 -0
  56. package/src/hooks/internal.ts +179 -22
  57. package/src/hooks/useAgentTrackRecord.ts +5 -2
  58. package/src/hooks/useCompletionBond.ts +191 -0
  59. package/src/hooks/useDispute.ts +46 -9
  60. package/src/hooks/useHire.ts +113 -23
  61. package/src/hooks/useHumanlessHireFlow.ts +335 -115
  62. package/src/hooks/useListing.ts +2 -2
  63. package/src/hooks/useListings.ts +2 -2
  64. package/src/hooks/useRateHire.ts +32 -5
  65. package/src/hooks/useReferrerEarnings.ts +4 -1
  66. package/src/hooks/useSubmissionReview.ts +95 -32
  67. package/src/hooks/useTaskActivation.ts +51 -9
  68. package/src/hooks/useTaskGuarantee.ts +123 -0
  69. package/src/hooks/useTaskLifecycle.ts +104 -24
  70. package/src/hooks/useTaskStatus.ts +121 -26
  71. package/src/hooks/useTaskWork.ts +76 -12
  72. package/src/hooks/useWalletSigner.ts +11 -16
  73. package/src/index.ts +5 -0
  74. package/src/provider/AgencProvider.tsx +95 -3
  75. package/src/provider/referrer.ts +1 -1
  76. package/src/signers/README.md +13 -7
  77. package/src/signers/index.ts +6 -1
  78. package/src/signers/strings.ts +13 -1
  79. package/src/signers/types.ts +16 -5
  80. package/src/signers/wallet-account.ts +115 -29
  81. package/src/signers/wallet-adapter.ts +38 -4
  82. package/src/theme/agenc-tailwind-preset.cjs +134 -108
  83. package/src/types.ts +32 -3
  84. package/dist/chunk-BNILOX3O.js.map +0 -1
  85. package/dist/chunk-BTAVED7S.js +0 -226
  86. package/dist/chunk-BTAVED7S.js.map +0 -1
  87. package/dist/chunk-ON6XR4XO.js +0 -128
  88. package/dist/chunk-ON6XR4XO.js.map +0 -1
@@ -1,1521 +1,166 @@
1
1
  'use strict';
2
2
 
3
- var marketplaceSdk = require('@tetsuo-ai/marketplace-sdk');
4
- var jsxRuntime = require('react/jsx-runtime');
5
- var react = require('react');
6
- var reactQuery = require('@tanstack/react-query');
7
- var kit = require('@solana/kit');
3
+ var chunkIJKWKY4H_cjs = require('../chunk-IJKWKY4H.cjs');
4
+ require('../chunk-JTSG5FGC.cjs');
5
+ require('../chunk-FIDFPM5A.cjs');
8
6
 
9
- // src/theme/index.ts
10
- var AGENC_THEME_CLASS = "agenc";
11
7
 
12
- // src/strings/index.ts
13
- var EN_STRINGS = {
14
- // Provider / context wiring errors (developer-facing, but routed for parity).
15
- "provider.missingContext": "useAgencContext must be used within <AgencProvider>.",
16
- "provider.missingWriteClient": "No write client is configured. Pass config.client, or config.rpcUrl + config.signer, to <AgencProvider> before using a mutating hook.",
17
- "provider.missingSigner": "No signer is configured on <AgencProvider>. Connect a wallet or pass config.signer.",
18
- // Referrer config validation / capability surface.
19
- "referrer.invalidWallet": "Referrer wallet is not a valid base58 Solana address: {wallet}.",
20
- "referrer.invalidFeeBps": "Referrer feeBps must be an integer between {min} and {max} (basis points); got {feeBps}.",
21
- "referrer.notLive": "Referral fee is not active for this hire.",
22
- "referrer.notLiveReason": "No referrer is configured for this provider.",
23
- "referrer.earningsNotLiveReason": "Referral settlement is live, but no earnings endpoint is available on this network (configure indexer.baseUrl).",
24
- "referrer.earningsFetchFailed": "The referrer earnings endpoint could not be read.",
25
- // Read transport.
26
- "transport.noReadSource": "No read source is configured. Pass an indexer baseUrl, an rpc/queryTransport, to <AgencProvider> or createReadTransport().",
27
- // Generic loading / empty / error states (components extend these).
28
- "state.loading": "Loading\u2026",
29
- "state.empty": "Nothing to show yet.",
30
- "state.error": "Something went wrong.",
31
- // Hire flow shells (components fill out the rest).
32
- "hire.cta": "Hire",
33
- "hire.pending": "Confirming\u2026",
34
- "hire.funded": "Escrow funded."
35
- };
36
- function t(id, vars, options) {
37
- const catalog = options?.catalog ?? EN_STRINGS;
38
- const template = catalog[id] ?? id;
39
- if (vars === void 0) return template;
40
- return template.replace(/\{(\w+)\}/g, (match, key) => {
41
- const value = vars[key];
42
- return value === void 0 ? match : String(value);
43
- });
44
- }
45
8
 
46
- // src/components/strings.ts
47
- var EN_COMPONENT_STRINGS = {
48
- // Shared / cross-component.
49
- "components.common.loading": "Loading\u2026",
50
- "components.common.empty": "Nothing to show yet.",
51
- "components.common.error": "Something went wrong.",
52
- "components.common.retry": "Retry",
53
- "components.common.close": "Close",
54
- "components.common.verified": "Verified",
55
- "components.common.unverified": "Unverified",
56
- "components.common.sol": "SOL",
57
- "components.common.lamports": "lamports",
58
- // ListingCard.
59
- "components.listingCard.priceLabel": "Price",
60
- "components.listingCard.byProvider": "by {provider}",
61
- "components.listingCard.untitled": "Untitled service",
62
- "components.listingCard.hires": "{count} hires",
63
- "components.listingCard.category": "Category",
64
- // ListingGrid.
65
- "components.listingGrid.empty": "No listings match your filters yet.",
66
- "components.listingGrid.loadMore": "Load more",
67
- "components.listingGrid.error": "Could not load listings.",
68
- // HireButton / Checkout.
69
- "components.hire.cta": "Hire",
70
- "components.hire.ctaPrice": "Hire \u2014 {price}",
71
- "components.hire.checkoutTitle": "Confirm hire",
72
- "components.hire.priceLabel": "You pay",
73
- "components.hire.escrowNote": "Funds are held in protocol escrow and released to the provider only when you accept the result.",
74
- "components.hire.confirm": "Confirm and fund escrow",
75
- "components.hire.cancel": "Cancel",
76
- "components.hire.pending": "Confirming\u2026",
77
- "components.hire.success": "Escrow funded.",
78
- "components.hire.successDetail": "Your task is created. Track it below.",
79
- "components.hire.viewTask": "View task",
80
- "components.hire.errorTitle": "Hire failed",
81
- "components.hire.moderationAttested": "Moderation attested",
82
- "components.hire.moderationPending": "Moderation pending",
83
- "components.hire.moderationIssues": "Moderation issues found",
84
- "components.hire.notConnected": "Connect a wallet to hire.",
85
- // Referrer disclosure.
86
- "components.referrer.disclosure": "This site earns a referral fee.",
87
- "components.referrer.disclosurePending": "Referral fee is not active for this hire.",
88
- "components.referrer.feeBps": "{bps} bps",
89
- // TaskTimeline.
90
- "components.taskTimeline.title": "Task progress",
91
- "components.taskTimeline.empty": "No task to track yet.",
92
- "components.taskTimeline.status.Open": "Open",
93
- "components.taskTimeline.status.InProgress": "In progress",
94
- "components.taskTimeline.status.PendingValidation": "Pending review",
95
- "components.taskTimeline.status.Completed": "Completed",
96
- "components.taskTimeline.status.Cancelled": "Cancelled",
97
- "components.taskTimeline.status.Disputed": "Disputed",
98
- "components.taskTimeline.status.RejectFrozen": "Rejected (frozen)",
99
- // ReviewPanel.
100
- "components.review.title": "Review submission",
101
- "components.review.noSubmission": "Awaiting the worker's submission.",
102
- "components.review.accept": "Accept and release escrow",
103
- "components.review.reject": "Reject",
104
- "components.review.requestChanges": "Request changes",
105
- "components.review.accepted": "Result accepted. Escrow released.",
106
- "components.review.rejected": "Result rejected.",
107
- "components.review.changesRequested": "Changes requested.",
108
- "components.review.pending": "Submitting\u2026",
109
- "components.review.errorTitle": "Review action failed",
110
- // DisputeBanner.
111
- "components.dispute.title": "This task is in dispute.",
112
- "components.dispute.body": "A dispute has been opened. A protocol resolver decides the outcome; funds stay in escrow until then.",
113
- "components.dispute.initiate": "Open a dispute",
114
- "components.dispute.pending": "Opening dispute\u2026",
115
- "components.dispute.opened": "Dispute opened.",
116
- "components.dispute.none": "No open dispute.",
117
- "components.dispute.errorTitle": "Could not open dispute",
118
- // ProviderCard.
119
- "components.provider.title": "Provider",
120
- "components.provider.completionRate": "Completion rate",
121
- "components.provider.disputeRate": "Dispute rate",
122
- "components.provider.completions": "{count} completed",
123
- "components.provider.disputes": "{count} disputes",
124
- "components.provider.provisional": "provisional",
125
- "components.provider.noData": "No track record yet.",
126
- "components.provider.unavailable": "Track record is unavailable on this read transport.",
127
- // Domain trust (P7.3) — VERIFIED is an on-chain attestation; CLAIMED is the
128
- // operator's self-reported metadata. The copy keeps them distinct so a buyer
129
- // never reads an unverified claim as a proven one.
130
- "components.provider.verifiedDomain": "Verified: {domain}",
131
- "components.provider.verifiedDomainLabel": "Verified domain {domain}",
132
- "components.provider.claimedDomain": "Claims: {domain}",
133
- "components.provider.claimedDomainLabel": "Claimed domain {domain} (not verified on-chain)",
134
- // PoweredByAgenC.
135
- "components.poweredBy.label": "Powered by AgenC",
136
- "components.poweredBy.trustLink": "Learn how this works"
137
- };
138
- var COMPONENT_CATALOG = {
139
- ...EN_STRINGS,
140
- ...EN_COMPONENT_STRINGS
141
- };
142
-
143
- // src/components/format.ts
144
- function tc(id, vars, options) {
145
- return t(id, vars, { catalog: COMPONENT_CATALOG, ...options });
146
- }
147
- var LAMPORTS_PER_SOL = 1000000000n;
148
- function formatSol(lamports) {
149
- const negative = lamports < 0n;
150
- const abs = negative ? -lamports : lamports;
151
- const whole = abs / LAMPORTS_PER_SOL;
152
- const frac = abs % LAMPORTS_PER_SOL;
153
- let out;
154
- if (frac === 0n) {
155
- out = whole.toString();
156
- } else {
157
- const fracStr = frac.toString().padStart(9, "0").replace(/0+$/, "");
158
- out = `${whole.toString()}.${fracStr}`;
159
- }
160
- return negative ? `-${out}` : out;
161
- }
162
- function formatPriceSol(lamports, options) {
163
- return `${formatSol(lamports)} ${t("components.common.sol", void 0, {
164
- catalog: COMPONENT_CATALOG,
165
- ...options
166
- })}`;
167
- }
168
- function truncateAddress(value, head = 4, tail = 4) {
169
- if (value === null || value === void 0) return "";
170
- const s = String(value);
171
- if (s.length <= head + tail + 1) return s;
172
- return `${s.slice(0, head)}\u2026${s.slice(-tail)}`;
173
- }
174
- function decodeListingName(listing) {
175
- try {
176
- return marketplaceSdk.values.decodeListingName(Uint8Array.from(listing.name));
177
- } catch {
178
- return "";
179
- }
180
- }
181
- function decodeListingCategory(listing) {
182
- try {
183
- return marketplaceSdk.values.decodeListingCategory(Uint8Array.from(listing.category));
184
- } catch {
185
- return "";
186
- }
187
- }
188
- function decodeListingTags(listing) {
189
- try {
190
- return marketplaceSdk.values.decodeListingTags(Uint8Array.from(listing.tags));
191
- } catch {
192
- return [];
193
- }
194
- }
195
- function toHex(bytes) {
196
- let out = "";
197
- for (let i = 0; i < bytes.length; i++) {
198
- out += bytes[i].toString(16).padStart(2, "0");
199
- }
200
- return out;
201
- }
202
- function formatRate(rate, fallback = "\u2014") {
203
- if (rate === null || Number.isNaN(rate)) return fallback;
204
- const pct = Math.round(rate * 100);
205
- return `${pct}%`;
206
- }
207
- function cx(...parts) {
208
- return parts.filter((p) => Boolean(p)).join(" ");
209
- }
210
- function elementClass(base, unstyled, extra) {
211
- if (unstyled) return extra && extra.trim() !== "" ? extra : void 0;
212
- return cx(base, extra) || void 0;
213
- }
214
- function rootClass(base, unstyled, extra) {
215
- if (unstyled) return extra && extra.trim() !== "" ? extra : void 0;
216
- return cx(AGENC_THEME_CLASS, base, extra) || void 0;
217
- }
218
- var STATE_STRING = {
219
- loading: "components.common.loading",
220
- empty: "components.common.empty",
221
- error: "components.common.error"
222
- };
223
- function StateMessage({
224
- kind,
225
- message,
226
- onRetry,
227
- role,
228
- unstyled,
229
- className
230
- }) {
231
- const text = message ?? tc(STATE_STRING[kind]);
232
- const resolvedRole = role ?? (kind === "error" ? "alert" : "status");
233
- return /* @__PURE__ */ jsxRuntime.jsxs(
234
- "div",
235
- {
236
- className: elementClass(`agenc-state agenc-state--${kind}`, unstyled, className),
237
- role: resolvedRole,
238
- "aria-live": kind === "error" ? "assertive" : "polite",
239
- "aria-busy": kind === "loading" ? true : void 0,
240
- children: [
241
- kind === "loading" ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { unstyled }) : null,
242
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-state__text", children: text }),
243
- onRetry && kind !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(Button, { unstyled, variant: "ghost", onClick: onRetry, children: tc("components.common.retry") }) : null
244
- ]
245
- }
246
- );
247
- }
248
- function Spinner({ label, unstyled, className }) {
249
- return /* @__PURE__ */ jsxRuntime.jsx(
250
- "span",
251
- {
252
- className: elementClass("agenc-spinner", unstyled, className),
253
- role: "status",
254
- "aria-live": "polite",
255
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-visually-hidden", children: label ?? tc("components.common.loading") })
256
- }
257
- );
258
- }
259
- function Badge({
260
- tone = "neutral",
261
- children,
262
- label,
263
- unstyled,
264
- className
265
- }) {
266
- return /* @__PURE__ */ jsxRuntime.jsx(
267
- "span",
268
- {
269
- className: elementClass(
270
- `agenc-badge agenc-badge--${tone}`,
271
- unstyled,
272
- className
273
- ),
274
- title: label,
275
- "aria-label": label,
276
- children
277
- }
278
- );
279
- }
280
- function Button({
281
- variant = "primary",
282
- loading = false,
283
- unstyled,
284
- className,
285
- children,
286
- disabled,
287
- type,
288
- ...rest
289
- }) {
290
- return /* @__PURE__ */ jsxRuntime.jsxs(
291
- "button",
292
- {
293
- type: type ?? "button",
294
- className: elementClass(
295
- `agenc-button agenc-button--${variant}`,
296
- unstyled,
297
- className
298
- ),
299
- disabled: disabled || loading,
300
- "aria-busy": loading || void 0,
301
- ...rest,
302
- children: [
303
- loading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { unstyled }) : null,
304
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-button__label", children })
305
- ]
306
- }
307
- );
308
- }
309
- function moderationStateOf(moderation) {
310
- if (!moderation) return "pending";
311
- return moderation.metadataValid ? "attested" : "issues";
312
- }
313
- var MODERATION_TONE = {
314
- attested: "success",
315
- pending: "neutral",
316
- issues: "warning"
317
- };
318
- var MODERATION_STRING = {
319
- attested: "components.hire.moderationAttested",
320
- pending: "components.hire.moderationPending",
321
- // Distinct from `pending` ("Moderation pending") so a buyer can textually
322
- // tell "we found problems" apart from "we haven't checked", not just by tone.
323
- issues: "components.hire.moderationIssues"
324
- };
325
- function ModerationBadge({
326
- moderation,
327
- state,
328
- unstyled,
329
- className
330
- }) {
331
- const resolved = state ?? moderationStateOf(moderation);
332
- const label = tc(MODERATION_STRING[resolved]);
333
- const issues = resolved === "issues" && moderation?.metadataIssues?.length ? moderation.metadataIssues.join("; ") : void 0;
334
- return /* @__PURE__ */ jsxRuntime.jsx(
335
- Badge,
336
- {
337
- tone: MODERATION_TONE[resolved],
338
- unstyled,
339
- className,
340
- label: issues ?? label,
341
- children: label
342
- }
343
- );
344
- }
345
- function VerifiedBadge({
346
- verified,
347
- unstyled,
348
- className
349
- }) {
350
- return /* @__PURE__ */ jsxRuntime.jsx(
351
- Badge,
352
- {
353
- tone: verified ? "success" : "neutral",
354
- unstyled,
355
- className,
356
- children: verified ? tc("components.common.verified") : tc("components.common.unverified")
357
- }
358
- );
359
- }
360
- var FOCUSABLE_SELECTOR = [
361
- "a[href]",
362
- "button:not([disabled])",
363
- "textarea:not([disabled])",
364
- "input:not([disabled])",
365
- "select:not([disabled])",
366
- '[tabindex]:not([tabindex="-1"])'
367
- ].join(",");
368
- function focusableWithin(container) {
369
- return Array.from(
370
- container.querySelectorAll(FOCUSABLE_SELECTOR)
371
- ).filter((el) => el.offsetParent !== null || el === document.activeElement);
372
- }
373
- function useFocusTrap(containerRef, active, onEscape) {
374
- react.useEffect(() => {
375
- if (!active) return;
376
- const container = containerRef.current;
377
- if (!container) return;
378
- const previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
379
- const initial = focusableWithin(container)[0] ?? container;
380
- initial.focus();
381
- function onKeyDown(event) {
382
- if (event.key === "Escape") {
383
- event.stopPropagation();
384
- onEscape?.();
385
- return;
386
- }
387
- if (event.key !== "Tab") return;
388
- const focusable = focusableWithin(container);
389
- if (focusable.length === 0) {
390
- event.preventDefault();
391
- container.focus();
392
- return;
393
- }
394
- const first = focusable[0];
395
- const last = focusable[focusable.length - 1];
396
- const activeEl = document.activeElement;
397
- if (event.shiftKey) {
398
- if (activeEl === first || activeEl === container) {
399
- event.preventDefault();
400
- last.focus();
401
- }
402
- } else if (activeEl === last) {
403
- event.preventDefault();
404
- first.focus();
405
- }
406
- }
407
- function onFocusIn(event) {
408
- const target = event.target;
409
- if (!(target instanceof Node)) return;
410
- if (container.contains(target)) return;
411
- event.stopPropagation();
412
- const focusable = focusableWithin(container);
413
- (focusable[0] ?? container).focus();
414
- }
415
- container.addEventListener("keydown", onKeyDown);
416
- document.addEventListener("focusin", onFocusIn);
417
- return () => {
418
- container.removeEventListener("keydown", onKeyDown);
419
- document.removeEventListener("focusin", onFocusIn);
420
- previouslyFocused?.focus();
421
- };
422
- }, [containerRef, active, onEscape]);
423
- }
424
- function Modal({
425
- open,
426
- onClose,
427
- title,
428
- children,
429
- footer,
430
- disableEscapeClose = false,
431
- disableOverlayClose = false,
432
- hideCloseButton = false,
433
- closeLabel,
434
- unstyled,
435
- className
436
- }) {
437
- const dialogRef = react.useRef(null);
438
- const titleId = react.useId();
439
- const bodyId = react.useId();
440
- useFocusTrap(dialogRef, open, () => {
441
- if (!disableEscapeClose) onClose();
442
- });
443
- if (!open) return null;
444
- const overlayClass = rootClass("agenc-modal", unstyled, className);
445
- return /* @__PURE__ */ jsxRuntime.jsx(
446
- "div",
447
- {
448
- className: overlayClass,
449
- onMouseDown: (event) => {
450
- if (disableOverlayClose) return;
451
- if (event.target === event.currentTarget) onClose();
452
- },
453
- children: /* @__PURE__ */ jsxRuntime.jsxs(
454
- "div",
455
- {
456
- className: unstyled ? void 0 : "agenc-modal__dialog",
457
- ref: dialogRef,
458
- role: "dialog",
459
- "aria-modal": "true",
460
- "aria-labelledby": titleId,
461
- "aria-describedby": bodyId,
462
- tabIndex: -1,
463
- children: [
464
- /* @__PURE__ */ jsxRuntime.jsxs("header", { className: unstyled ? void 0 : "agenc-modal__header", children: [
465
- /* @__PURE__ */ jsxRuntime.jsx("h2", { id: titleId, className: unstyled ? void 0 : "agenc-modal__title", children: title }),
466
- hideCloseButton ? null : /* @__PURE__ */ jsxRuntime.jsx(
467
- "button",
468
- {
469
- type: "button",
470
- className: unstyled ? void 0 : "agenc-modal__close",
471
- "aria-label": closeLabel ?? tc("components.common.close"),
472
- onClick: onClose,
473
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "\xD7" })
474
- }
475
- )
476
- ] }),
477
- /* @__PURE__ */ jsxRuntime.jsx("div", { id: bodyId, className: unstyled ? void 0 : "agenc-modal__body", children }),
478
- footer ? /* @__PURE__ */ jsxRuntime.jsx("footer", { className: unstyled ? void 0 : "agenc-modal__footer", children: footer }) : null
479
- ]
480
- }
481
- )
482
- }
483
- );
484
- }
485
- function ListingCard({
486
- listing,
487
- moderation,
488
- onHire,
489
- onSelect,
490
- hidePrice = false,
491
- unstyled,
492
- className
493
- }) {
494
- const { account } = listing;
495
- const name = decodeListingName(account) || tc("components.listingCard.untitled");
496
- const category = decodeListingCategory(account);
497
- const price = formatPriceSol(account.price);
498
- const provider = truncateAddress(account.providerAgent);
499
- const hires = account.totalHires;
500
- const cardClass = rootClass("agenc-listing-card", unstyled, className);
501
- const selectable = Boolean(onSelect);
502
- const heading = /* @__PURE__ */ jsxRuntime.jsx("h3", { className: unstyled ? void 0 : "agenc-listing-card__title", children: name });
503
- return /* @__PURE__ */ jsxRuntime.jsxs(
504
- "article",
505
- {
506
- className: cardClass,
507
- "aria-label": name,
508
- children: [
509
- /* @__PURE__ */ jsxRuntime.jsxs("header", { className: unstyled ? void 0 : "agenc-listing-card__header", children: [
510
- selectable ? /* @__PURE__ */ jsxRuntime.jsx(
511
- "button",
512
- {
513
- type: "button",
514
- className: unstyled ? void 0 : "agenc-listing-card__title-button",
515
- onClick: () => onSelect?.(listing),
516
- children: heading
517
- }
518
- ) : heading,
519
- /* @__PURE__ */ jsxRuntime.jsx(ModerationBadge, { moderation, unstyled })
520
- ] }),
521
- /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: unstyled ? void 0 : "agenc-listing-card__meta", children: [
522
- category ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-listing-card__meta-row", children: [
523
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: tc("components.listingCard.category") }),
524
- /* @__PURE__ */ jsxRuntime.jsx("dd", { children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { tone: "info", unstyled, children: category }) })
525
- ] }) : null,
526
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-listing-card__meta-row", children: [
527
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: tc("components.listingCard.byProvider", { provider }) }),
528
- /* @__PURE__ */ jsxRuntime.jsx("dd", { children: tc("components.listingCard.hires", { count: String(hires) }) })
529
- ] })
530
- ] }),
531
- /* @__PURE__ */ jsxRuntime.jsxs("footer", { className: unstyled ? void 0 : "agenc-listing-card__footer", children: [
532
- hidePrice ? null : /* @__PURE__ */ jsxRuntime.jsxs("p", { className: unstyled ? void 0 : "agenc-listing-card__price", children: [
533
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-listing-card__price-label", children: tc("components.listingCard.priceLabel") }),
534
- " ",
535
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-listing-card__price-value", children: price })
536
- ] }),
537
- onHire ? /* @__PURE__ */ jsxRuntime.jsx(
538
- Button,
539
- {
540
- unstyled,
541
- variant: "primary",
542
- onClick: () => onHire(listing),
543
- children: tc("components.hire.cta")
544
- }
545
- ) : null
546
- ] })
547
- ]
548
- }
549
- );
550
- }
551
- function ListingGrid({
552
- listings,
553
- isLoading = false,
554
- error = null,
555
- hasMore = false,
556
- onLoadMore,
557
- onRetry,
558
- onHire,
559
- onSelect,
560
- moderationByPda,
561
- emptyMessage,
562
- unstyled,
563
- className
564
- }) {
565
- const gridClass = rootClass("agenc-listing-grid", unstyled, className);
566
- if (error) {
567
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: gridClass, children: /* @__PURE__ */ jsxRuntime.jsx(
568
- StateMessage,
569
- {
570
- kind: "error",
571
- message: tc("components.listingGrid.error"),
572
- onRetry,
573
- unstyled
574
- }
575
- ) });
576
- }
577
- if (isLoading && listings.length === 0) {
578
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: gridClass, children: /* @__PURE__ */ jsxRuntime.jsx(StateMessage, { kind: "loading", unstyled }) });
579
- }
580
- if (listings.length === 0) {
581
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: gridClass, children: /* @__PURE__ */ jsxRuntime.jsx(
582
- StateMessage,
583
- {
584
- kind: "empty",
585
- message: emptyMessage ?? tc("components.listingGrid.empty"),
586
- unstyled
587
- }
588
- ) });
589
- }
590
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: gridClass, children: [
591
- /* @__PURE__ */ jsxRuntime.jsx(
592
- "ul",
593
- {
594
- className: unstyled ? void 0 : "agenc-listing-grid__list",
595
- children: listings.map((listing) => /* @__PURE__ */ jsxRuntime.jsx(
596
- "li",
597
- {
598
- className: unstyled ? void 0 : "agenc-listing-grid__item",
599
- children: /* @__PURE__ */ jsxRuntime.jsx(
600
- ListingCard,
601
- {
602
- listing,
603
- moderation: moderationByPda?.[String(listing.address)] ?? null,
604
- onHire,
605
- onSelect,
606
- unstyled
607
- }
608
- )
609
- },
610
- String(listing.address)
611
- ))
612
- }
613
- ),
614
- hasMore && onLoadMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: unstyled ? void 0 : "agenc-listing-grid__more", children: /* @__PURE__ */ jsxRuntime.jsx(
615
- "button",
616
- {
617
- type: "button",
618
- className: unstyled ? void 0 : "agenc-button agenc-button--secondary",
619
- onClick: onLoadMore,
620
- children: tc("components.listingGrid.loadMore")
621
- }
622
- ) }) : null
623
- ] });
624
- }
625
- var AgencContext = react.createContext(null);
626
- AgencContext.displayName = "AgencContext";
627
- function useAgencContext() {
628
- const ctx = react.useContext(AgencContext);
629
- if (ctx === null) {
630
- throw new Error(t("provider.missingContext"));
631
- }
632
- return ctx;
633
- }
634
-
635
- // src/hooks/internal.ts
636
- function requireClient(client) {
637
- if (client === null) {
638
- throw new Error(t("provider.missingWriteClient"));
639
- }
640
- return client;
641
- }
642
- function resolveReferrerArgs(ctx) {
643
- const capability = ctx.resolveReferrerCapability();
644
- if (!capability.live || !capability.referrer) {
645
- return { referrerArgs: {}, referrerInjected: false };
646
- }
647
- return {
648
- referrerArgs: {
649
- referrer: capability.referrer.wallet,
650
- referrerFeeBps: capability.referrer.feeBps
651
- },
652
- referrerInjected: true
653
- };
654
- }
655
- function signerAddress(signerOrAddress) {
656
- if (typeof signerOrAddress === "string") {
657
- return signerOrAddress;
658
- }
659
- if (typeof signerOrAddress === "object" && signerOrAddress !== null && "address" in signerOrAddress && typeof signerOrAddress.address === "string") {
660
- return signerOrAddress.address;
661
- }
662
- throw new Error("Expected a TransactionSigner or Address with an address field.");
663
- }
664
- function withoutReferrerArgs(input) {
665
- const {
666
- referrer: _referrer,
667
- referrerFeeBps: _referrerFeeBps,
668
- ...rest
669
- } = input;
670
- return rest;
671
- }
672
- function readRpc(input) {
673
- return input.rpc ?? (input.rpcUrl ? kit.createSolanaRpc(input.rpcUrl) : null);
674
- }
675
- async function resolveRosterEntry(rpc, moderator) {
676
- const [moderationConfigPda] = await marketplaceSdk.findModerationConfigPda();
677
- const moderationConfig = await marketplaceSdk.fetchMaybeModerationConfig(
678
- rpc,
679
- moderationConfigPda
680
- );
681
- if (moderationConfig.exists && moderationConfig.data.moderationAuthority === moderator) {
682
- return void 0;
683
- }
684
- const [rosterPda] = await marketplaceSdk.findModerationAttestorPda({ attestor: moderator });
685
- const roster = await marketplaceSdk.fetchMaybeModerationAttestor(rpc, rosterPda);
686
- return roster.exists ? rosterPda : void 0;
687
- }
688
- async function resolveHireListingModerationAccounts(input) {
689
- try {
690
- const rpc = readRpc(input);
691
- if (!rpc) return {};
692
- const moderationAttestor = await resolveRosterEntry(rpc, input.moderator);
693
- const attestorPart = moderationAttestor !== void 0 ? { moderationAttestor } : {};
694
- const [v2Pda] = await marketplaceSdk.findListingModerationPda({
695
- listing: input.listing,
696
- jobSpecHash: input.listingSpecHash,
697
- moderator: input.moderator
698
- });
699
- const v2 = await marketplaceSdk.fetchMaybeListingModeration(rpc, v2Pda);
700
- if (v2.exists) return attestorPart;
701
- const [legacyPda] = await marketplaceSdk.facade.findLegacyListingModerationPda({
702
- listing: input.listing,
703
- jobSpecHash: input.listingSpecHash
704
- });
705
- const legacy = await marketplaceSdk.fetchMaybeListingModeration(rpc, legacyPda);
706
- if (legacy.exists && legacy.data.moderator === input.moderator) {
707
- return { ...attestorPart, listingModeration: legacyPda };
708
- }
709
- return attestorPart;
710
- } catch {
711
- return {};
712
- }
713
- }
714
-
715
- // src/hooks/useHire.ts
716
- function useHire() {
717
- const ctx = useAgencContext();
718
- const mutation = reactQuery.useMutation({
719
- mutationFn: async (input) => {
720
- const client = requireClient(ctx.client);
721
- const { referrerArgs, referrerInjected } = resolveReferrerArgs(ctx);
722
- const hireInput = withoutReferrerArgs(input);
723
- const listingSpecHash = input.listingSpecHash;
724
- let moderationArgs = {};
725
- if (input.moderationAttestor === void 0 && input.moderatorIsAttestor === void 0 && input.listingModeration === void 0 && listingSpecHash !== void 0) {
726
- moderationArgs = await resolveHireListingModerationAccounts({
727
- rpcUrl: ctx.rpcUrl,
728
- listing: input.listing,
729
- listingSpecHash,
730
- moderator: input.moderator
731
- });
732
- }
733
- const creator = input.creator ?? client.signer;
734
- let signature;
735
- if (input.humanless === true) {
736
- const result = await client.hireFromListingHumanless({
737
- ...hireInput,
738
- ...moderationArgs,
739
- creator,
740
- ...referrerArgs
741
- });
742
- signature = result.signature;
743
- } else {
744
- const authority = input.authority ?? client.signer;
745
- const result = await client.hireFromListing({
746
- ...hireInput,
747
- ...moderationArgs,
748
- authority,
749
- creator,
750
- ...referrerArgs
751
- });
752
- signature = result.signature;
753
- }
754
- const [taskPda] = await marketplaceSdk.findTaskPda({
755
- creator: signerAddress(creator),
756
- taskId: input.taskId
757
- });
758
- return { signature, taskPda, referrerInjected };
759
- }
760
- });
761
- const hire = react.useCallback(
762
- (input) => mutation.mutateAsync(input),
763
- [mutation]
764
- );
765
- const status = react.useMemo(() => {
766
- if (mutation.isPending) return "pending";
767
- if (mutation.isError) return "error";
768
- if (mutation.isSuccess) return "success";
769
- return "idle";
770
- }, [mutation.isPending, mutation.isError, mutation.isSuccess]);
771
- return {
772
- hire,
773
- status,
774
- taskPda: mutation.data?.taskPda ?? null,
775
- signature: mutation.data?.signature ?? null,
776
- error: mutation.error ?? null,
777
- isPending: mutation.isPending,
778
- reset: mutation.reset
779
- };
780
- }
781
- function useWalletSigner(options) {
782
- const ctx = useAgencContext();
783
- const adapter = options?.adapter;
784
- const signer = ctx.signer ?? null;
785
- const connected = adapter !== void 0 ? adapter.connected ?? adapter.signer !== null : ctx.signer !== null;
786
- const connect = react.useCallback(() => {
787
- return void 0;
788
- }, [adapter]);
789
- return { signer, connected, connect };
790
- }
791
- function ReferrerDisclosure({
792
- referrer,
793
- live = false,
794
- showFee = true,
795
- unstyled,
796
- className
797
- }) {
798
- const text = live ? tc("components.referrer.disclosure") : tc("components.referrer.disclosurePending");
799
- return /* @__PURE__ */ jsxRuntime.jsxs(
800
- "p",
801
- {
802
- className: unstyled ? className : cx("agenc-referrer-disclosure", className),
803
- role: "note",
804
- children: [
805
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: text }),
806
- showFee ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: unstyled ? void 0 : "agenc-referrer-disclosure__fee", children: [
807
- " ",
808
- tc("components.referrer.feeBps", { bps: String(referrer.feeBps) })
809
- ] }) : null
810
- ]
811
- }
812
- );
813
- }
814
- function HireCheckoutModal({
815
- open,
816
- onClose,
817
- listing,
818
- onConfirm,
819
- status = "idle",
820
- error = null,
821
- taskPda = null,
822
- onViewTask,
823
- moderation,
824
- referrer,
825
- referrerLive = false,
826
- connected = true,
827
- unstyled,
828
- className
829
- }) {
830
- const pending = status === "pending";
831
- const success = status === "success";
832
- const price = formatPriceSol(listing.account.price);
833
- const [submitting, setSubmitting] = react.useState(false);
834
- const submittingRef = react.useRef(false);
835
- react.useEffect(() => {
836
- if (!open || !pending) {
837
- submittingRef.current = false;
838
- setSubmitting(false);
839
- }
840
- }, [open, pending]);
841
- const handleConfirm = react.useCallback(() => {
842
- if (submittingRef.current) return;
843
- submittingRef.current = true;
844
- setSubmitting(true);
845
- let result;
846
- try {
847
- result = onConfirm();
848
- } catch {
849
- submittingRef.current = false;
850
- setSubmitting(false);
851
- return;
852
- }
853
- if (result && typeof result.then === "function") {
854
- void result.finally(() => {
855
- submittingRef.current = false;
856
- setSubmitting(false);
857
- });
858
- }
859
- }, [onConfirm]);
860
- const confirmDisabled = !connected || pending || submitting;
861
- const lockClose = pending || submitting;
862
- const footer = success ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
863
- taskPda && onViewTask ? /* @__PURE__ */ jsxRuntime.jsx(
864
- Button,
865
- {
866
- unstyled,
867
- variant: "primary",
868
- onClick: () => onViewTask(taskPda),
869
- children: tc("components.hire.viewTask")
870
- }
871
- ) : null,
872
- /* @__PURE__ */ jsxRuntime.jsx(Button, { unstyled, variant: "secondary", onClick: onClose, children: tc("components.common.close") })
873
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
874
- /* @__PURE__ */ jsxRuntime.jsx(
875
- Button,
876
- {
877
- unstyled,
878
- variant: "secondary",
879
- onClick: onClose,
880
- disabled: pending || submitting,
881
- children: tc("components.hire.cancel")
882
- }
883
- ),
884
- /* @__PURE__ */ jsxRuntime.jsx(
885
- Button,
886
- {
887
- unstyled,
888
- variant: "primary",
889
- loading: pending || submitting,
890
- disabled: confirmDisabled,
891
- onClick: handleConfirm,
892
- children: pending || submitting ? tc("components.hire.pending") : tc("components.hire.confirm")
893
- }
894
- )
895
- ] });
896
- return /* @__PURE__ */ jsxRuntime.jsx(
897
- Modal,
898
- {
899
- open,
900
- onClose,
901
- title: tc("components.hire.checkoutTitle"),
902
- footer,
903
- disableEscapeClose: lockClose,
904
- disableOverlayClose: lockClose,
905
- hideCloseButton: lockClose,
906
- unstyled,
907
- className,
908
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-checkout", children: [
909
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-checkout__row", children: [
910
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-checkout__price-label", children: tc("components.hire.priceLabel") }),
911
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-checkout__price", children: price })
912
- ] }),
913
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: unstyled ? void 0 : "agenc-checkout__moderation", children: /* @__PURE__ */ jsxRuntime.jsx(ModerationBadge, { moderation, unstyled }) }),
914
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: unstyled ? void 0 : "agenc-checkout__escrow-note", children: tc("components.hire.escrowNote") }),
915
- referrer ? /* @__PURE__ */ jsxRuntime.jsx(
916
- ReferrerDisclosure,
917
- {
918
- referrer,
919
- live: referrerLive,
920
- unstyled
921
- }
922
- ) : null,
923
- /* @__PURE__ */ jsxRuntime.jsxs(
924
- "div",
925
- {
926
- className: unstyled ? void 0 : "agenc-checkout__status",
927
- role: "status",
928
- "aria-live": "polite",
929
- children: [
930
- pending ? tc("components.hire.pending") : null,
931
- success ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
932
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: tc("components.hire.success") }),
933
- " ",
934
- tc("components.hire.successDetail")
935
- ] }) : null
936
- ]
937
- }
938
- ),
939
- error ? /* @__PURE__ */ jsxRuntime.jsxs(
940
- "div",
941
- {
942
- className: unstyled ? void 0 : "agenc-checkout__error",
943
- role: "alert",
944
- "aria-live": "assertive",
945
- children: [
946
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: tc("components.hire.errorTitle") }),
947
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: error.message })
948
- ]
949
- }
950
- ) : null,
951
- !connected && !success ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: unstyled ? void 0 : "agenc-checkout__hint", children: tc("components.hire.notConnected") }) : null
952
- ] })
953
- }
954
- );
955
- }
956
- function HireButton({
957
- listing,
958
- buildHireInput,
959
- onHired,
960
- onViewTask,
961
- showPriceInLabel = true,
962
- label,
963
- unstyled,
964
- className
965
- }) {
966
- const ctx = useAgencContext();
967
- const { hire, status, error, taskPda, reset } = useHire();
968
- const { connected } = useWalletSigner();
969
- const [open, setOpen] = react.useState(false);
970
- const inFlightRef = react.useRef(false);
971
- const capability = ctx.resolveReferrerCapability();
972
- const close = react.useCallback(() => {
973
- setOpen(false);
974
- inFlightRef.current = false;
975
- reset();
976
- }, [reset]);
977
- const confirm = react.useCallback(async () => {
978
- if (inFlightRef.current) return;
979
- inFlightRef.current = true;
980
- try {
981
- const input = buildHireInput(listing);
982
- const result = await hire(input);
983
- onHired?.(result.taskPda);
984
- } finally {
985
- inFlightRef.current = false;
986
- }
987
- }, [buildHireInput, hire, listing, onHired]);
988
- const buttonLabel = label ?? (showPriceInLabel ? tc("components.hire.ctaPrice", {
989
- price: formatPriceSol(listing.account.price)
990
- }) : tc("components.hire.cta"));
991
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
992
- /* @__PURE__ */ jsxRuntime.jsx(
993
- Button,
994
- {
995
- unstyled,
996
- className,
997
- variant: "primary",
998
- onClick: () => setOpen(true),
999
- children: buttonLabel
1000
- }
1001
- ),
1002
- /* @__PURE__ */ jsxRuntime.jsx(
1003
- HireCheckoutModal,
1004
- {
1005
- open,
1006
- onClose: close,
1007
- listing,
1008
- onConfirm: confirm,
1009
- status,
1010
- error,
1011
- taskPda,
1012
- onViewTask,
1013
- referrer: ctx.referrer,
1014
- referrerLive: capability.live,
1015
- connected,
1016
- unstyled
1017
- }
1018
- )
1019
- ] });
1020
- }
1021
- var HAPPY_PATH = [
1022
- { status: marketplaceSdk.TaskStatus.Open, stringId: "components.taskTimeline.status.Open" },
1023
- {
1024
- status: marketplaceSdk.TaskStatus.InProgress,
1025
- stringId: "components.taskTimeline.status.InProgress"
1026
- },
1027
- {
1028
- status: marketplaceSdk.TaskStatus.PendingValidation,
1029
- stringId: "components.taskTimeline.status.PendingValidation"
1030
- },
1031
- {
1032
- status: marketplaceSdk.TaskStatus.Completed,
1033
- stringId: "components.taskTimeline.status.Completed"
1034
- }
1035
- ];
1036
- var OFF_PATH = {
1037
- [marketplaceSdk.TaskStatus.Cancelled]: {
1038
- stringId: "components.taskTimeline.status.Cancelled",
1039
- tone: "cancelled"
1040
- },
1041
- [marketplaceSdk.TaskStatus.Disputed]: {
1042
- stringId: "components.taskTimeline.status.Disputed",
1043
- tone: "disputed"
1044
- },
1045
- [marketplaceSdk.TaskStatus.RejectFrozen]: {
1046
- stringId: "components.taskTimeline.status.RejectFrozen",
1047
- tone: "rejected"
1048
- }
1049
- };
1050
- function happyIndex(status) {
1051
- return HAPPY_PATH.findIndex((s) => s.status === status);
1052
- }
1053
- function TaskTimeline({
1054
- status,
1055
- isLoading = false,
1056
- error = null,
1057
- onRetry,
1058
- unstyled,
1059
- className
1060
- }) {
1061
- const timelineClass = rootClass("agenc-timeline", unstyled, className);
1062
- if (error) {
1063
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: timelineClass, children: /* @__PURE__ */ jsxRuntime.jsx(StateMessage, { kind: "error", onRetry, unstyled }) });
1064
- }
1065
- if (isLoading && status === null) {
1066
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: timelineClass, children: /* @__PURE__ */ jsxRuntime.jsx(StateMessage, { kind: "loading", unstyled }) });
1067
- }
1068
- if (status === null) {
1069
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: timelineClass, children: /* @__PURE__ */ jsxRuntime.jsx(
1070
- StateMessage,
1071
- {
1072
- kind: "empty",
1073
- message: tc("components.taskTimeline.empty"),
1074
- unstyled
1075
- }
1076
- ) });
1077
- }
1078
- const offPath = OFF_PATH[status];
1079
- const currentIndex = offPath ? -1 : happyIndex(status);
1080
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: timelineClass, "aria-label": tc("components.taskTimeline.title"), children: [
1081
- /* @__PURE__ */ jsxRuntime.jsx("ol", { className: unstyled ? void 0 : "agenc-timeline__list", children: HAPPY_PATH.map((stage, index) => {
1082
- const done = currentIndex > index;
1083
- const current = currentIndex === index;
1084
- const state = done ? "done" : current ? "current" : "upcoming";
1085
- return /* @__PURE__ */ jsxRuntime.jsxs(
1086
- "li",
1087
- {
1088
- className: unstyled ? void 0 : cx("agenc-timeline__step", `agenc-timeline__step--${state}`),
1089
- "aria-current": current ? "step" : void 0,
1090
- children: [
1091
- /* @__PURE__ */ jsxRuntime.jsx(
1092
- "span",
1093
- {
1094
- className: unstyled ? void 0 : "agenc-timeline__marker",
1095
- "aria-hidden": "true"
1096
- }
1097
- ),
1098
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-timeline__label", children: tc(stage.stringId) })
1099
- ]
1100
- },
1101
- stage.status
1102
- );
1103
- }) }),
1104
- offPath ? /* @__PURE__ */ jsxRuntime.jsx(
1105
- "p",
1106
- {
1107
- className: unstyled ? void 0 : cx(
1108
- "agenc-timeline__terminal",
1109
- `agenc-timeline__terminal--${offPath.tone}`
1110
- ),
1111
- role: "status",
1112
- children: tc(offPath.stringId)
1113
- }
1114
- ) : null
1115
- ] });
1116
- }
1117
- var SUCCESS_STRING = {
1118
- accept: "components.review.accepted",
1119
- reject: "components.review.rejected",
1120
- requestChanges: "components.review.changesRequested"
1121
- };
1122
- function ReviewPanel({
1123
- hasSubmission = false,
1124
- onAccept,
1125
- onReject,
1126
- onRequestChanges,
1127
- status = "idle",
1128
- error = null,
1129
- settledAction,
1130
- unstyled,
1131
- className
1132
- }) {
1133
- const panelClass = rootClass("agenc-review", unstyled, className);
1134
- const pending = status === "pending";
1135
- const success = status === "success";
1136
- return /* @__PURE__ */ jsxRuntime.jsxs(
1137
- "section",
1138
- {
1139
- className: panelClass,
1140
- "aria-label": tc("components.review.title"),
1141
- children: [
1142
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: unstyled ? void 0 : "agenc-review__title", children: tc("components.review.title") }),
1143
- !hasSubmission ? /* @__PURE__ */ jsxRuntime.jsx(
1144
- StateMessage,
1145
- {
1146
- kind: "empty",
1147
- message: tc("components.review.noSubmission"),
1148
- unstyled
1149
- }
1150
- ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-review__actions", children: [
1151
- /* @__PURE__ */ jsxRuntime.jsx(
1152
- Button,
1153
- {
1154
- unstyled,
1155
- variant: "primary",
1156
- loading: pending,
1157
- disabled: pending || !onAccept,
1158
- onClick: onAccept,
1159
- children: tc("components.review.accept")
1160
- }
1161
- ),
1162
- /* @__PURE__ */ jsxRuntime.jsx(
1163
- Button,
1164
- {
1165
- unstyled,
1166
- variant: "secondary",
1167
- disabled: pending || !onRequestChanges,
1168
- onClick: onRequestChanges,
1169
- children: tc("components.review.requestChanges")
1170
- }
1171
- ),
1172
- /* @__PURE__ */ jsxRuntime.jsx(
1173
- Button,
1174
- {
1175
- unstyled,
1176
- variant: "danger",
1177
- disabled: pending || !onReject,
1178
- onClick: onReject,
1179
- children: tc("components.review.reject")
1180
- }
1181
- )
1182
- ] }),
1183
- /* @__PURE__ */ jsxRuntime.jsxs(
1184
- "div",
1185
- {
1186
- className: unstyled ? void 0 : "agenc-review__status",
1187
- role: "status",
1188
- "aria-live": "polite",
1189
- children: [
1190
- pending ? tc("components.review.pending") : null,
1191
- success && settledAction ? tc(SUCCESS_STRING[settledAction]) : null
1192
- ]
1193
- }
1194
- ),
1195
- error ? /* @__PURE__ */ jsxRuntime.jsxs(
1196
- "div",
1197
- {
1198
- className: unstyled ? void 0 : "agenc-review__error",
1199
- role: "alert",
1200
- "aria-live": "assertive",
1201
- children: [
1202
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: tc("components.review.errorTitle") }),
1203
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: error.message })
1204
- ]
1205
- }
1206
- ) : null
1207
- ]
1208
- }
1209
- );
1210
- }
1211
- function DisputeBanner({
1212
- disputeOpen = false,
1213
- onInitiate,
1214
- status = "idle",
1215
- error = null,
1216
- unstyled,
1217
- className
1218
- }) {
1219
- const bannerClass = rootClass(
1220
- cx(
1221
- "agenc-dispute",
1222
- disputeOpen ? "agenc-dispute--open" : "agenc-dispute--none"
1223
- ),
1224
- unstyled,
1225
- className
1226
- );
1227
- const pending = status === "pending";
1228
- const opened = status === "success";
1229
- if (disputeOpen) {
1230
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: bannerClass, role: "alert", children: [
1231
- /* @__PURE__ */ jsxRuntime.jsx("strong", { className: unstyled ? void 0 : "agenc-dispute__title", children: tc("components.dispute.title") }),
1232
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: unstyled ? void 0 : "agenc-dispute__body", children: tc("components.dispute.body") })
1233
- ] });
1234
- }
1235
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: bannerClass, role: "region", "aria-label": tc("components.dispute.none"), children: [
1236
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: unstyled ? void 0 : "agenc-dispute__none", children: tc("components.dispute.none") }),
1237
- onInitiate ? /* @__PURE__ */ jsxRuntime.jsx(
1238
- Button,
1239
- {
1240
- unstyled,
1241
- variant: "secondary",
1242
- loading: pending,
1243
- disabled: pending,
1244
- onClick: onInitiate,
1245
- children: pending ? tc("components.dispute.pending") : tc("components.dispute.initiate")
1246
- }
1247
- ) : null,
1248
- /* @__PURE__ */ jsxRuntime.jsx(
1249
- "div",
1250
- {
1251
- className: unstyled ? void 0 : "agenc-dispute__status",
1252
- role: "status",
1253
- "aria-live": "polite",
1254
- children: opened ? tc("components.dispute.opened") : null
1255
- }
1256
- ),
1257
- error ? /* @__PURE__ */ jsxRuntime.jsxs(
1258
- "div",
1259
- {
1260
- className: unstyled ? void 0 : "agenc-dispute__error",
1261
- role: "alert",
1262
- "aria-live": "assertive",
1263
- children: [
1264
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: tc("components.dispute.errorTitle") }),
1265
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: error.message })
1266
- ]
1267
- }
1268
- ) : null
1269
- ] });
1270
- }
1271
- var UNVERIFIED = Object.freeze({
1272
- verified: false
9
+ Object.defineProperty(exports, "Badge", {
10
+ enumerable: true,
11
+ get: function () { return chunkIJKWKY4H_cjs.Badge; }
12
+ });
13
+ Object.defineProperty(exports, "Button", {
14
+ enumerable: true,
15
+ get: function () { return chunkIJKWKY4H_cjs.Button; }
16
+ });
17
+ Object.defineProperty(exports, "COMPONENT_CATALOG", {
18
+ enumerable: true,
19
+ get: function () { return chunkIJKWKY4H_cjs.COMPONENT_CATALOG; }
20
+ });
21
+ Object.defineProperty(exports, "DEFAULT_TRUST_HREF", {
22
+ enumerable: true,
23
+ get: function () { return chunkIJKWKY4H_cjs.DEFAULT_TRUST_HREF; }
24
+ });
25
+ Object.defineProperty(exports, "DisputeBanner", {
26
+ enumerable: true,
27
+ get: function () { return chunkIJKWKY4H_cjs.DisputeBanner; }
28
+ });
29
+ Object.defineProperty(exports, "EN_COMPONENT_STRINGS", {
30
+ enumerable: true,
31
+ get: function () { return chunkIJKWKY4H_cjs.EN_COMPONENT_STRINGS; }
32
+ });
33
+ Object.defineProperty(exports, "GuaranteedBadge", {
34
+ enumerable: true,
35
+ get: function () { return chunkIJKWKY4H_cjs.GuaranteedBadge; }
36
+ });
37
+ Object.defineProperty(exports, "HireButton", {
38
+ enumerable: true,
39
+ get: function () { return chunkIJKWKY4H_cjs.HireButton; }
40
+ });
41
+ Object.defineProperty(exports, "HireCheckoutModal", {
42
+ enumerable: true,
43
+ get: function () { return chunkIJKWKY4H_cjs.HireCheckoutModal; }
44
+ });
45
+ Object.defineProperty(exports, "ListingCard", {
46
+ enumerable: true,
47
+ get: function () { return chunkIJKWKY4H_cjs.ListingCard; }
48
+ });
49
+ Object.defineProperty(exports, "ListingGrid", {
50
+ enumerable: true,
51
+ get: function () { return chunkIJKWKY4H_cjs.ListingGrid; }
52
+ });
53
+ Object.defineProperty(exports, "Modal", {
54
+ enumerable: true,
55
+ get: function () { return chunkIJKWKY4H_cjs.Modal; }
56
+ });
57
+ Object.defineProperty(exports, "ModerationBadge", {
58
+ enumerable: true,
59
+ get: function () { return chunkIJKWKY4H_cjs.ModerationBadge; }
60
+ });
61
+ Object.defineProperty(exports, "PoweredByAgenC", {
62
+ enumerable: true,
63
+ get: function () { return chunkIJKWKY4H_cjs.PoweredByAgenC; }
64
+ });
65
+ Object.defineProperty(exports, "ProviderCard", {
66
+ enumerable: true,
67
+ get: function () { return chunkIJKWKY4H_cjs.ProviderCard; }
68
+ });
69
+ Object.defineProperty(exports, "ReferrerDisclosure", {
70
+ enumerable: true,
71
+ get: function () { return chunkIJKWKY4H_cjs.ReferrerDisclosure; }
72
+ });
73
+ Object.defineProperty(exports, "ReviewPanel", {
74
+ enumerable: true,
75
+ get: function () { return chunkIJKWKY4H_cjs.ReviewPanel; }
76
+ });
77
+ Object.defineProperty(exports, "Spinner", {
78
+ enumerable: true,
79
+ get: function () { return chunkIJKWKY4H_cjs.Spinner; }
80
+ });
81
+ Object.defineProperty(exports, "StateMessage", {
82
+ enumerable: true,
83
+ get: function () { return chunkIJKWKY4H_cjs.StateMessage; }
84
+ });
85
+ Object.defineProperty(exports, "TaskTimeline", {
86
+ enumerable: true,
87
+ get: function () { return chunkIJKWKY4H_cjs.TaskTimeline; }
88
+ });
89
+ Object.defineProperty(exports, "UNVERIFIED", {
90
+ enumerable: true,
91
+ get: function () { return chunkIJKWKY4H_cjs.UNVERIFIED; }
92
+ });
93
+ Object.defineProperty(exports, "VerifiedBadge", {
94
+ enumerable: true,
95
+ get: function () { return chunkIJKWKY4H_cjs.VerifiedBadge; }
96
+ });
97
+ Object.defineProperty(exports, "agentVerificationReaderFromRpc", {
98
+ enumerable: true,
99
+ get: function () { return chunkIJKWKY4H_cjs.agentVerificationReaderFromRpc; }
100
+ });
101
+ Object.defineProperty(exports, "cx", {
102
+ enumerable: true,
103
+ get: function () { return chunkIJKWKY4H_cjs.cx; }
104
+ });
105
+ Object.defineProperty(exports, "decodeListingCategory", {
106
+ enumerable: true,
107
+ get: function () { return chunkIJKWKY4H_cjs.decodeListingCategory; }
108
+ });
109
+ Object.defineProperty(exports, "decodeListingName", {
110
+ enumerable: true,
111
+ get: function () { return chunkIJKWKY4H_cjs.decodeListingName; }
112
+ });
113
+ Object.defineProperty(exports, "decodeListingTags", {
114
+ enumerable: true,
115
+ get: function () { return chunkIJKWKY4H_cjs.decodeListingTags; }
116
+ });
117
+ Object.defineProperty(exports, "elementClass", {
118
+ enumerable: true,
119
+ get: function () { return chunkIJKWKY4H_cjs.elementClass; }
120
+ });
121
+ Object.defineProperty(exports, "evaluateAgentVerification", {
122
+ enumerable: true,
123
+ get: function () { return chunkIJKWKY4H_cjs.evaluateAgentVerification; }
124
+ });
125
+ Object.defineProperty(exports, "formatPriceSol", {
126
+ enumerable: true,
127
+ get: function () { return chunkIJKWKY4H_cjs.formatPriceSol; }
128
+ });
129
+ Object.defineProperty(exports, "formatRate", {
130
+ enumerable: true,
131
+ get: function () { return chunkIJKWKY4H_cjs.formatRate; }
132
+ });
133
+ Object.defineProperty(exports, "formatSol", {
134
+ enumerable: true,
135
+ get: function () { return chunkIJKWKY4H_cjs.formatSol; }
136
+ });
137
+ Object.defineProperty(exports, "moderationStateOf", {
138
+ enumerable: true,
139
+ get: function () { return chunkIJKWKY4H_cjs.moderationStateOf; }
140
+ });
141
+ Object.defineProperty(exports, "rootClass", {
142
+ enumerable: true,
143
+ get: function () { return chunkIJKWKY4H_cjs.rootClass; }
144
+ });
145
+ Object.defineProperty(exports, "tc", {
146
+ enumerable: true,
147
+ get: function () { return chunkIJKWKY4H_cjs.tc; }
148
+ });
149
+ Object.defineProperty(exports, "toHex", {
150
+ enumerable: true,
151
+ get: function () { return chunkIJKWKY4H_cjs.toHex; }
152
+ });
153
+ Object.defineProperty(exports, "truncateAddress", {
154
+ enumerable: true,
155
+ get: function () { return chunkIJKWKY4H_cjs.truncateAddress; }
156
+ });
157
+ Object.defineProperty(exports, "useAgentVerification", {
158
+ enumerable: true,
159
+ get: function () { return chunkIJKWKY4H_cjs.useAgentVerification; }
160
+ });
161
+ Object.defineProperty(exports, "useFocusTrap", {
162
+ enumerable: true,
163
+ get: function () { return chunkIJKWKY4H_cjs.useFocusTrap; }
1273
164
  });
1274
- function evaluateAgentVerification(account, nowSeconds) {
1275
- if (!account) return UNVERIFIED;
1276
- if (account.revoked) return UNVERIFIED;
1277
- if (account.expiresAt !== 0n && nowSeconds >= account.expiresAt) {
1278
- return UNVERIFIED;
1279
- }
1280
- return {
1281
- verified: true,
1282
- domain: account.verifiedDomain,
1283
- method: account.method,
1284
- verifiedBy: account.verifiedBy,
1285
- verifiedAt: account.verifiedAt,
1286
- expiresAt: account.expiresAt,
1287
- revoked: false
1288
- };
1289
- }
1290
- function defaultNow() {
1291
- return BigInt(Math.floor(Date.now() / 1e3));
1292
- }
1293
- function agentVerificationReaderFromRpc(rpc, options) {
1294
- const now = options?.now ?? defaultNow;
1295
- return async (agentPda) => {
1296
- const [pda] = await marketplaceSdk.findAgentVerificationPda({ agent: agentPda });
1297
- const maybe = await marketplaceSdk.fetchMaybeAgentVerification(rpc, pda);
1298
- return evaluateAgentVerification(maybe.exists ? maybe.data : null, now());
1299
- };
1300
- }
1301
- function useAgentVerification(agentPda, options) {
1302
- const reader = options?.reader;
1303
- const enabled = (options?.enabled ?? true) && Boolean(agentPda) && Boolean(reader);
1304
- const query = reactQuery.useQuery({
1305
- queryKey: ["agenc", "agentVerification", agentPda ? String(agentPda) : ""],
1306
- enabled,
1307
- queryFn: async () => {
1308
- return reader(agentPda);
1309
- }
1310
- });
1311
- const verification = query.error ? UNVERIFIED : query.data ?? UNVERIFIED;
1312
- return {
1313
- verification,
1314
- verified: verification.verified,
1315
- isLoading: query.isLoading && enabled,
1316
- error: query.error ?? null,
1317
- refetch: () => void query.refetch()
1318
- };
1319
- }
1320
- function VerifiedDomainBadge({
1321
- domain,
1322
- unstyled
1323
- }) {
1324
- return /* @__PURE__ */ jsxRuntime.jsx(
1325
- Badge,
1326
- {
1327
- tone: "success",
1328
- unstyled,
1329
- className: unstyled ? void 0 : "agenc-provider__domain agenc-provider__domain--verified",
1330
- label: tc("components.provider.verifiedDomainLabel", { domain }),
1331
- children: tc("components.provider.verifiedDomain", { domain })
1332
- }
1333
- );
1334
- }
1335
- function ClaimedDomainBadge({
1336
- domain,
1337
- unstyled
1338
- }) {
1339
- return /* @__PURE__ */ jsxRuntime.jsx(
1340
- Badge,
1341
- {
1342
- tone: "neutral",
1343
- unstyled,
1344
- className: unstyled ? void 0 : "agenc-provider__domain agenc-provider__domain--claimed",
1345
- label: tc("components.provider.claimedDomainLabel", { domain }),
1346
- children: tc("components.provider.claimedDomain", { domain })
1347
- }
1348
- );
1349
- }
1350
- function ProviderCard({
1351
- agent,
1352
- trackRecord,
1353
- verification = UNVERIFIED,
1354
- operatorDomain,
1355
- verified = false,
1356
- isLoading = false,
1357
- error = null,
1358
- onRetry,
1359
- unstyled,
1360
- className
1361
- }) {
1362
- const cardClass = rootClass("agenc-provider", unstyled, className);
1363
- const isVerified = verification.verified || verification === UNVERIFIED && verified;
1364
- const verifiedDomain = verification.verified ? verification.domain : null;
1365
- const claimed = typeof operatorDomain === "string" && operatorDomain.trim() !== "" ? operatorDomain.trim() : null;
1366
- const domainBadge = verifiedDomain ? /* @__PURE__ */ jsxRuntime.jsx(VerifiedDomainBadge, { domain: verifiedDomain, unstyled }) : claimed ? /* @__PURE__ */ jsxRuntime.jsx(ClaimedDomainBadge, { domain: claimed, unstyled }) : null;
1367
- const header = /* @__PURE__ */ jsxRuntime.jsxs("header", { className: unstyled ? void 0 : "agenc-provider__header", children: [
1368
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-provider__id", children: [
1369
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-provider__label", children: tc("components.provider.title") }),
1370
- agent ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-provider__pda", children: truncateAddress(agent) }) : null
1371
- ] }),
1372
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-provider__badges", children: [
1373
- domainBadge,
1374
- /* @__PURE__ */ jsxRuntime.jsx(VerifiedBadge, { verified: isVerified, unstyled })
1375
- ] })
1376
- ] });
1377
- if (error) {
1378
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: cardClass, "aria-label": tc("components.provider.title"), children: [
1379
- header,
1380
- /* @__PURE__ */ jsxRuntime.jsx(
1381
- StateMessage,
1382
- {
1383
- kind: "error",
1384
- message: tc("components.provider.unavailable"),
1385
- onRetry,
1386
- unstyled
1387
- }
1388
- )
1389
- ] });
1390
- }
1391
- if (isLoading && trackRecord === null) {
1392
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: cardClass, "aria-label": tc("components.provider.title"), children: [
1393
- header,
1394
- /* @__PURE__ */ jsxRuntime.jsx(StateMessage, { kind: "loading", unstyled })
1395
- ] });
1396
- }
1397
- if (trackRecord === null) {
1398
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: cardClass, "aria-label": tc("components.provider.title"), children: [
1399
- header,
1400
- /* @__PURE__ */ jsxRuntime.jsx(
1401
- StateMessage,
1402
- {
1403
- kind: "empty",
1404
- message: tc("components.provider.noData"),
1405
- unstyled
1406
- }
1407
- )
1408
- ] });
1409
- }
1410
- const provisional = trackRecord.partial;
1411
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: cardClass, "aria-label": tc("components.provider.title"), children: [
1412
- header,
1413
- /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: unstyled ? void 0 : "agenc-provider__stats", children: [
1414
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-provider__stat", children: [
1415
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: tc("components.provider.completionRate") }),
1416
- /* @__PURE__ */ jsxRuntime.jsxs("dd", { children: [
1417
- formatRate(trackRecord.completionRate),
1418
- provisional ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: unstyled ? void 0 : "agenc-provider__provisional", children: [
1419
- " ",
1420
- "(",
1421
- tc("components.provider.provisional"),
1422
- ")"
1423
- ] }) : null
1424
- ] })
1425
- ] }),
1426
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-provider__stat", children: [
1427
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: tc("components.provider.disputeRate") }),
1428
- /* @__PURE__ */ jsxRuntime.jsxs("dd", { children: [
1429
- formatRate(trackRecord.disputeRate),
1430
- provisional ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: unstyled ? void 0 : "agenc-provider__provisional", children: [
1431
- " ",
1432
- "(",
1433
- tc("components.provider.provisional"),
1434
- ")"
1435
- ] }) : null
1436
- ] })
1437
- ] }),
1438
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-provider__stat", children: [
1439
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: tc("components.provider.completions", {
1440
- count: String(trackRecord.completions)
1441
- }) }),
1442
- /* @__PURE__ */ jsxRuntime.jsx("dd", { children: tc("components.provider.disputes", {
1443
- count: String(trackRecord.disputesLost)
1444
- }) })
1445
- ] })
1446
- ] })
1447
- ] });
1448
- }
1449
- var DEFAULT_TRUST_HREF = "https://agenc.tech/trust";
1450
- var SAFE_HREF_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:", "mailto:"]);
1451
- function safeHref(href) {
1452
- try {
1453
- const url = new URL(href, DEFAULT_TRUST_HREF);
1454
- return SAFE_HREF_SCHEMES.has(url.protocol) ? href : DEFAULT_TRUST_HREF;
1455
- } catch {
1456
- return DEFAULT_TRUST_HREF;
1457
- }
1458
- }
1459
- function PoweredByAgenC({
1460
- href = DEFAULT_TRUST_HREF,
1461
- newTab = true,
1462
- label,
1463
- unstyled,
1464
- className
1465
- }) {
1466
- const linkClass = rootClass("agenc-powered-by", unstyled, className);
1467
- return /* @__PURE__ */ jsxRuntime.jsx(
1468
- "a",
1469
- {
1470
- className: linkClass,
1471
- href: safeHref(href),
1472
- target: newTab ? "_blank" : void 0,
1473
- rel: newTab ? "noopener noreferrer" : void 0,
1474
- "aria-label": `${label ?? tc("components.poweredBy.label")} \u2014 ${tc(
1475
- "components.poweredBy.trustLink"
1476
- )}`,
1477
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-powered-by__label", children: label ?? tc("components.poweredBy.label") })
1478
- }
1479
- );
1480
- }
1481
-
1482
- exports.Badge = Badge;
1483
- exports.Button = Button;
1484
- exports.COMPONENT_CATALOG = COMPONENT_CATALOG;
1485
- exports.DEFAULT_TRUST_HREF = DEFAULT_TRUST_HREF;
1486
- exports.DisputeBanner = DisputeBanner;
1487
- exports.EN_COMPONENT_STRINGS = EN_COMPONENT_STRINGS;
1488
- exports.HireButton = HireButton;
1489
- exports.HireCheckoutModal = HireCheckoutModal;
1490
- exports.ListingCard = ListingCard;
1491
- exports.ListingGrid = ListingGrid;
1492
- exports.Modal = Modal;
1493
- exports.ModerationBadge = ModerationBadge;
1494
- exports.PoweredByAgenC = PoweredByAgenC;
1495
- exports.ProviderCard = ProviderCard;
1496
- exports.ReferrerDisclosure = ReferrerDisclosure;
1497
- exports.ReviewPanel = ReviewPanel;
1498
- exports.Spinner = Spinner;
1499
- exports.StateMessage = StateMessage;
1500
- exports.TaskTimeline = TaskTimeline;
1501
- exports.UNVERIFIED = UNVERIFIED;
1502
- exports.VerifiedBadge = VerifiedBadge;
1503
- exports.agentVerificationReaderFromRpc = agentVerificationReaderFromRpc;
1504
- exports.cx = cx;
1505
- exports.decodeListingCategory = decodeListingCategory;
1506
- exports.decodeListingName = decodeListingName;
1507
- exports.decodeListingTags = decodeListingTags;
1508
- exports.elementClass = elementClass;
1509
- exports.evaluateAgentVerification = evaluateAgentVerification;
1510
- exports.formatPriceSol = formatPriceSol;
1511
- exports.formatRate = formatRate;
1512
- exports.formatSol = formatSol;
1513
- exports.moderationStateOf = moderationStateOf;
1514
- exports.rootClass = rootClass;
1515
- exports.tc = tc;
1516
- exports.toHex = toHex;
1517
- exports.truncateAddress = truncateAddress;
1518
- exports.useAgentVerification = useAgentVerification;
1519
- exports.useFocusTrap = useFocusTrap;
1520
165
  //# sourceMappingURL=index.cjs.map
1521
166
  //# sourceMappingURL=index.cjs.map