@tetsuo-ai/marketplace-react 0.4.1 → 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 (84) hide show
  1. package/CHANGELOG.md +56 -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-JVXGNW3Q.js → chunk-CDDHUFMG.js} +6 -5
  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-XLA7DARS.js → chunk-RG5JZ6JL.js} +159 -36
  18. package/dist/chunk-RG5JZ6JL.js.map +1 -0
  19. package/dist/components/index.cjs +158 -1594
  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 +656 -509
  25. package/dist/hooks/index.cjs.map +1 -1
  26. package/dist/hooks/index.d.cts +63 -29
  27. package/dist/hooks/index.d.ts +63 -29
  28. package/dist/hooks/index.js +619 -196
  29. package/dist/hooks/index.js.map +1 -1
  30. package/dist/{index-CmVz0OOm.d.ts → index-BAyr1ODZ.d.ts} +28 -3
  31. package/dist/{index-DAZzhuO4.d.cts → index-C20NVU7_.d.cts} +28 -3
  32. package/dist/index.cjs +284 -1833
  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-DPt3SfYz.d.cts → useAgentTrackRecord-Ch7gHTFj.d.cts} +1 -1
  49. package/dist/{useAgentTrackRecord-DPt3SfYz.d.ts → useAgentTrackRecord-Ch7gHTFj.d.ts} +1 -1
  50. package/package.json +6 -3
  51. package/src/components/HireCheckoutModal.tsx +5 -2
  52. package/src/hooks/index.ts +1 -0
  53. package/src/hooks/internal.ts +178 -24
  54. package/src/hooks/useAgentTrackRecord.ts +5 -2
  55. package/src/hooks/useCompletionBond.ts +56 -21
  56. package/src/hooks/useDispute.ts +46 -9
  57. package/src/hooks/useHire.ts +113 -23
  58. package/src/hooks/useHumanlessHireFlow.ts +335 -115
  59. package/src/hooks/useListing.ts +2 -2
  60. package/src/hooks/useListings.ts +2 -2
  61. package/src/hooks/useRateHire.ts +32 -5
  62. package/src/hooks/useReferrerEarnings.ts +4 -1
  63. package/src/hooks/useSubmissionReview.ts +95 -32
  64. package/src/hooks/useTaskActivation.ts +51 -9
  65. package/src/hooks/useTaskGuarantee.ts +4 -1
  66. package/src/hooks/useTaskLifecycle.ts +104 -24
  67. package/src/hooks/useTaskStatus.ts +121 -26
  68. package/src/hooks/useTaskWork.ts +76 -12
  69. package/src/hooks/useWalletSigner.ts +11 -16
  70. package/src/index.ts +3 -0
  71. package/src/provider/AgencProvider.tsx +95 -3
  72. package/src/provider/referrer.ts +1 -1
  73. package/src/signers/README.md +13 -7
  74. package/src/signers/index.ts +6 -1
  75. package/src/signers/strings.ts +13 -1
  76. package/src/signers/types.ts +16 -5
  77. package/src/signers/wallet-account.ts +115 -29
  78. package/src/signers/wallet-adapter.ts +38 -4
  79. package/src/theme/agenc-tailwind-preset.cjs +134 -108
  80. package/src/types.ts +27 -1
  81. package/dist/chunk-JVXGNW3Q.js.map +0 -1
  82. package/dist/chunk-ON6XR4XO.js +0 -128
  83. package/dist/chunk-ON6XR4XO.js.map +0 -1
  84. package/dist/chunk-XLA7DARS.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,144 +1,16 @@
1
1
  'use strict';
2
2
 
3
+ var chunkONC6L3IX_cjs = require('./chunk-ONC6L3IX.cjs');
4
+ var chunkR76EUYDI_cjs = require('./chunk-R76EUYDI.cjs');
5
+ var chunkIJKWKY4H_cjs = require('./chunk-IJKWKY4H.cjs');
6
+ var chunkJTSG5FGC_cjs = require('./chunk-JTSG5FGC.cjs');
7
+ var chunkFIDFPM5A_cjs = require('./chunk-FIDFPM5A.cjs');
3
8
  var reactQuery = require('@tanstack/react-query');
4
9
  var marketplaceSdk = require('@tetsuo-ai/marketplace-sdk');
5
10
  var react = require('react');
6
11
  var kit = require('@solana/kit');
7
12
  var jsxRuntime = require('react/jsx-runtime');
8
13
 
9
- // src/provider/AgencProvider.tsx
10
-
11
- // src/strings/index.ts
12
- var EN_STRINGS = {
13
- // Provider / context wiring errors (developer-facing, but routed for parity).
14
- "provider.missingContext": "useAgencContext must be used within <AgencProvider>.",
15
- "provider.missingWriteClient": "No write client is configured. Pass config.client, or config.rpcUrl + config.signer, to <AgencProvider> before using a mutating hook.",
16
- "provider.missingSigner": "No signer is configured on <AgencProvider>. Connect a wallet or pass config.signer.",
17
- // Referrer config validation / capability surface.
18
- "referrer.invalidWallet": "Referrer wallet is not a valid base58 Solana address: {wallet}.",
19
- "referrer.invalidFeeBps": "Referrer feeBps must be an integer between {min} and {max} (basis points); got {feeBps}.",
20
- "referrer.notLive": "Referral fee is not active for this hire.",
21
- "referrer.notLiveReason": "No referrer is configured for this provider.",
22
- "referrer.earningsNotLiveReason": "Referral settlement is live, but no earnings endpoint is available on this network (configure indexer.baseUrl).",
23
- "referrer.earningsFetchFailed": "The referrer earnings endpoint could not be read.",
24
- // Read transport.
25
- "transport.noReadSource": "No read source is configured. Pass an indexer baseUrl, an rpc/queryTransport, to <AgencProvider> or createReadTransport().",
26
- // Generic loading / empty / error states (components extend these).
27
- "state.loading": "Loading\u2026",
28
- "state.empty": "Nothing to show yet.",
29
- "state.error": "Something went wrong.",
30
- // Hire flow shells (components fill out the rest).
31
- "hire.cta": "Hire",
32
- "hire.pending": "Confirming\u2026",
33
- "hire.funded": "Escrow funded."
34
- };
35
- function t(id, vars, options) {
36
- const catalog = options?.catalog ?? EN_STRINGS;
37
- const template = catalog[id] ?? id;
38
- if (vars === void 0) return template;
39
- return template.replace(/\{(\w+)\}/g, (match, key) => {
40
- const value = vars[key];
41
- return value === void 0 ? match : String(value);
42
- });
43
- }
44
-
45
- // src/transport/index.ts
46
- var ReadTransportUnsupportedError = class extends Error {
47
- /** The unsupported operation name. */
48
- operation;
49
- constructor(operation) {
50
- super(
51
- `Read operation "${operation}" requires the indexer backend; the gPA fallback has no trustless equivalent. Configure an indexer baseUrl on <AgencProvider> to use it.`
52
- );
53
- this.name = "ReadTransportUnsupportedError";
54
- this.operation = operation;
55
- }
56
- };
57
- function toAddress(pda) {
58
- if (typeof pda !== "string") return pda;
59
- if (!kit.isAddress(pda)) {
60
- throw new TypeError(`Not a valid base58 Solana address: ${pda}`);
61
- }
62
- return kit.address(pda);
63
- }
64
- function indexerReadTransport(config, indexerClientOptions) {
65
- const client = marketplaceSdk.createIndexerClient({
66
- baseUrl: config.baseUrl,
67
- apiKey: config.apiKey,
68
- ...indexerClientOptions ?? {}
69
- });
70
- return {
71
- kind: "indexer",
72
- listActiveListings: (options) => client.listActiveListings(options),
73
- async getListing(pda) {
74
- const listing = await client.getListing(pda);
75
- const account = marketplaceSdk.getServiceListingDecoder().decode(
76
- base64ToBytes(listing.accountData)
77
- );
78
- return {
79
- address: toAddress(listing.pda),
80
- account,
81
- indexer: listing
82
- };
83
- },
84
- listingHires: (pda) => client.listingHires(pda),
85
- agentTrackRecord: (pda) => client.agentTrackRecord(pda)
86
- };
87
- }
88
- function gpaReadTransport(rpc) {
89
- return {
90
- kind: "gpa",
91
- listActiveListings: (options) => marketplaceSdk.listActiveListings(rpc, options),
92
- async getListing(pda) {
93
- const target = toAddress(pda);
94
- const all = await marketplaceSdk.listActiveListings(rpc, {});
95
- const hit = all.find((entry) => entry.address === target);
96
- if (hit === void 0) {
97
- throw new Error(
98
- `Listing ${pda} not found among active listings via the gPA fallback (it may be inactive, or your RPC restricts getProgramAccounts \u2014 use an indexer baseUrl for single-listing lookups).`
99
- );
100
- }
101
- return { address: hit.address, account: hit.account };
102
- },
103
- listingHires() {
104
- return Promise.reject(new ReadTransportUnsupportedError("listingHires"));
105
- },
106
- agentTrackRecord() {
107
- return Promise.reject(
108
- new ReadTransportUnsupportedError("agentTrackRecord")
109
- );
110
- }
111
- };
112
- }
113
- function base64ToBytes(b64) {
114
- if (typeof atob === "function") {
115
- const binary = atob(b64);
116
- const bytes = new Uint8Array(binary.length);
117
- for (let i = 0; i < binary.length; i += 1) {
118
- bytes[i] = binary.charCodeAt(i);
119
- }
120
- return bytes;
121
- }
122
- return Uint8Array.from(Buffer.from(b64, "base64"));
123
- }
124
- function createReadTransport(config) {
125
- if (config.queryTransport) return config.queryTransport;
126
- if (config.indexer?.baseUrl) {
127
- return indexerReadTransport(config.indexer, config.indexerClientOptions);
128
- }
129
- if (config.rpc) return gpaReadTransport(config.rpc);
130
- throw new Error(t("transport.noReadSource"));
131
- }
132
- var AgencContext = react.createContext(null);
133
- AgencContext.displayName = "AgencContext";
134
- function useAgencContext() {
135
- const ctx = react.useContext(AgencContext);
136
- if (ctx === null) {
137
- throw new Error(t("provider.missingContext"));
138
- }
139
- return ctx;
140
- }
141
-
142
14
  // src/provider/network.ts
143
15
  var NETWORK_HTTP_DEFAULTS = {
144
16
  localnet: "http://127.0.0.1:8899",
@@ -170,11 +42,11 @@ var REFERRER_FEE_BPS_MAX = 2e3;
170
42
  function validateReferrerConfig(config) {
171
43
  const { wallet, feeBps } = config;
172
44
  if (typeof wallet !== "string" || !kit.isAddress(wallet)) {
173
- throw new TypeError(t("referrer.invalidWallet", { wallet: String(wallet) }));
45
+ throw new TypeError(chunkFIDFPM5A_cjs.t("referrer.invalidWallet", { wallet: String(wallet) }));
174
46
  }
175
47
  if (typeof feeBps !== "number" || !Number.isInteger(feeBps) || feeBps < REFERRER_FEE_BPS_MIN || feeBps > REFERRER_FEE_BPS_MAX) {
176
48
  throw new RangeError(
177
- t("referrer.invalidFeeBps", {
49
+ chunkFIDFPM5A_cjs.t("referrer.invalidFeeBps", {
178
50
  min: REFERRER_FEE_BPS_MIN,
179
51
  max: REFERRER_FEE_BPS_MAX,
180
52
  feeBps: String(feeBps)
@@ -187,7 +59,7 @@ function resolveReferrerCapability(referrer) {
187
59
  if (!referrer) {
188
60
  return {
189
61
  live: false,
190
- reason: t("referrer.notLiveReason")
62
+ reason: chunkFIDFPM5A_cjs.t("referrer.notLiveReason")
191
63
  };
192
64
  }
193
65
  return {
@@ -206,8 +78,42 @@ var DEFAULT_QUERY_CLIENT_CONFIG = {
206
78
  }
207
79
  }
208
80
  };
81
+ var OPAQUE_DEPLOYMENT_IDS = /* @__PURE__ */ new WeakMap();
82
+ var nextOpaqueDeploymentId = 1;
83
+ function opaqueDeploymentId(value) {
84
+ if (value === void 0) return null;
85
+ const existing = OPAQUE_DEPLOYMENT_IDS.get(value);
86
+ if (existing !== void 0) return existing;
87
+ const allocated = nextOpaqueDeploymentId++;
88
+ OPAQUE_DEPLOYMENT_IDS.set(value, allocated);
89
+ return allocated;
90
+ }
91
+ function cacheFingerprint(value) {
92
+ if (value == null) return null;
93
+ let hash = 0xcbf29ce484222325n;
94
+ for (let index = 0; index < value.length; index += 1) {
95
+ hash ^= BigInt(value.charCodeAt(index));
96
+ hash = BigInt.asUintN(64, hash * 0x100000001b3n);
97
+ }
98
+ return hash.toString(16).padStart(16, "0");
99
+ }
100
+ function resolveCacheNamespace(config, network, rpcUrl) {
101
+ const explicit = config.cacheNamespace?.trim();
102
+ if (config.cacheNamespace !== void 0 && !explicit) {
103
+ throw new TypeError("AgencProvider cacheNamespace must not be empty.");
104
+ }
105
+ return JSON.stringify({
106
+ version: 1,
107
+ network,
108
+ rpc: cacheFingerprint(rpcUrl),
109
+ indexer: cacheFingerprint(config.indexer?.baseUrl),
110
+ custom: cacheFingerprint(explicit),
111
+ queryTransport: explicit === void 0 ? opaqueDeploymentId(config.queryTransport) : null,
112
+ client: explicit === void 0 ? opaqueDeploymentId(config.client) : null
113
+ });
114
+ }
209
115
  function buildReadTransport(config) {
210
- return createReadTransport({
116
+ return chunkONC6L3IX_cjs.createReadTransport({
211
117
  indexer: config.indexer,
212
118
  queryTransport: config.queryTransport
213
119
  // The gPA read source is provided only via queryTransport in v1 (a kit RPC
@@ -231,6 +137,16 @@ function buildWriteClient(config, network) {
231
137
  signer: config.signer
232
138
  });
233
139
  }
140
+ function assertSignerMatchesNetwork(signer, network, source) {
141
+ const chain = typeof signer === "object" && signer !== null && "chain" in signer ? signer.chain : void 0;
142
+ if (typeof chain !== "string") return;
143
+ const expected = chunkR76EUYDI_cjs.walletStandardChainForNetwork(network);
144
+ if (chain !== expected) {
145
+ throw new Error(
146
+ `${source} is bound to ${chain}, but AgencProvider network ${network} requires ${expected}.`
147
+ );
148
+ }
149
+ }
234
150
  function AgencProvider(props) {
235
151
  const { config, children } = props;
236
152
  const [internalQueryClient] = react.useState(
@@ -239,6 +155,12 @@ function AgencProvider(props) {
239
155
  const queryClient = props.queryClient ?? internalQueryClient;
240
156
  const value = react.useMemo(() => {
241
157
  const network = config.network ?? "mainnet";
158
+ assertSignerMatchesNetwork(config.signer, network, "config.signer");
159
+ assertSignerMatchesNetwork(
160
+ config.client?.signer,
161
+ network,
162
+ "config.client.signer"
163
+ );
242
164
  const referrer = config.referrer ? validateReferrerConfig(config.referrer) : null;
243
165
  const read = buildReadTransport(config);
244
166
  const client = buildWriteClient(config, network);
@@ -247,1722 +169,251 @@ function AgencProvider(props) {
247
169
  config.rpcUrl,
248
170
  config.rpcSubscriptionsUrl
249
171
  );
172
+ const orchestrationRpcUrl = config.orchestrationRpc !== void 0 ? null : config.client !== void 0 ? config.rpcUrl ?? null : rpcUrl ?? null;
173
+ const cacheNamespace = resolveCacheNamespace(
174
+ config,
175
+ network,
176
+ rpcUrl ?? null
177
+ );
250
178
  return {
251
179
  network,
180
+ cacheNamespace,
252
181
  read,
253
182
  client,
254
183
  rpcUrl: rpcUrl ?? null,
184
+ orchestrationRpc: config.orchestrationRpc ?? null,
185
+ orchestrationRpcUrl,
255
186
  indexerBaseUrl: config.indexer?.baseUrl ?? null,
256
187
  signer: config.signer ?? null,
257
188
  referrer,
258
189
  resolveReferrerCapability: () => resolveReferrerCapability(referrer)
259
190
  };
260
191
  }, [config]);
261
- return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntime.jsx(AgencContext.Provider, { value, children }) });
262
- }
263
-
264
- // src/theme/index.ts
265
- var AGENC_THEME_CLASS = "agenc";
266
- var AGENC_TOKENS_CSS_PATH = "@tetsuo-ai/marketplace-react/theme.css";
267
- function resolveThemeClassName(unstyled, extra) {
268
- if (unstyled) {
269
- return extra && extra.trim() !== "" ? extra : void 0;
270
- }
271
- const composed = [AGENC_THEME_CLASS, extra].filter((part) => Boolean(part && part.trim() !== "")).join(" ");
272
- return composed === "" ? void 0 : composed;
273
- }
274
- function agencThemeStyleTag() {
275
- return `:root,.${AGENC_THEME_CLASS}{--agenc-void:#0A0612;--agenc-surface:#16102A;--agenc-surface-2:#221638;--agenc-surface-3:#2E1A4A;--agenc-violet:#7B3FFF;--agenc-magenta:#FF2E93;--agenc-orange:#FF6B1A;--agenc-cyan:#48C8EF;--agenc-text:#F5F0FF;--agenc-text-muted:#B8A8D9;--agenc-text-dim:#6E5C8F;--agenc-success:#3FFFA0;--agenc-warning:#FFC53F;--agenc-danger:#FF3D3D;--agenc-border:#2E1A4A;--agenc-border-strong:#4A2E7A;--agenc-radius-sm:4px;--agenc-radius:8px;--agenc-radius-lg:12px;--agenc-radius-pill:9999px;}`;
276
- }
277
-
278
- // src/signers/strings.ts
279
- var EN_SIGNER_STRINGS = {
280
- "signer.walletNoSignFeature": "Wallet account {address} does not expose a solana:signTransaction feature. Pass options.signTransaction explicitly, or use a Wallet Standard account that supports transaction signing.",
281
- "signer.walletNoSignature": "The wallet returned no signature for account {address}. The wallet may have rejected or modified the transaction so the fee-payer signature is absent.",
282
- "signer.embeddedSignatureCount": "Embedded wallet returned {got} signatures for {expected} transactions; expected one per transaction.",
283
- "signer.walletAdapterDisconnected": "The wallet adapter is not connected (publicKey is null). Connect the wallet before creating a signer.",
284
- "signer.walletAdapterNoSign": "The wallet adapter does not expose signTransaction. Use a wallet that supports transaction signing, or migrate to the Wallet Standard path (signerFromWalletAccount)."
285
- };
286
- function ts(id, vars) {
287
- return t(id, vars, { catalog: EN_SIGNER_STRINGS });
288
- }
289
-
290
- // src/signers/wallet-account.ts
291
- var SOLANA_SIGN_TRANSACTION = "solana:signTransaction";
292
- function resolveSignTransaction(account, options) {
293
- if (options.signTransaction) return options.signTransaction;
294
- const feature = account.features?.[SOLANA_SIGN_TRANSACTION];
295
- if (feature?.signTransaction) return feature.signTransaction;
296
- throw new Error(ts("signer.walletNoSignFeature", { address: account.address }));
297
- }
298
- function resolveChain(account, options) {
299
- if (options.chain) return options.chain;
300
- return account.chains?.find((c) => c.startsWith("solana:"));
301
- }
302
- function signerFromWalletAccount(account, options = {}) {
303
- const signerAddress2 = kit.address(account.address);
304
- const signTransaction = resolveSignTransaction(account, options);
305
- const chain = resolveChain(account, options);
306
- const encoder = kit.getTransactionEncoder();
307
- const decoder = kit.getTransactionDecoder();
308
- async function signOne(transaction) {
309
- const wireBytes = new Uint8Array(encoder.encode(transaction));
310
- const [output] = await signTransaction({
311
- transaction: wireBytes,
312
- ...chain ? { chain } : {}
313
- });
314
- if (!output) {
315
- throw new Error(ts("signer.walletNoSignature", { address: account.address }));
316
- }
317
- const signed = decoder.decode(output.signedTransaction);
318
- const signature = signed.signatures[signerAddress2];
319
- if (!signature) {
320
- throw new Error(ts("signer.walletNoSignature", { address: account.address }));
321
- }
322
- return signature;
323
- }
324
- return {
325
- address: signerAddress2,
326
- async signTransactions(transactions) {
327
- return Promise.all(
328
- transactions.map(async (transaction) => ({
329
- [signerAddress2]: await signOne(transaction)
330
- }))
331
- );
332
- }
333
- };
334
- }
335
- function resolveAdapterAddress(adapter) {
336
- const { publicKey } = adapter;
337
- if (publicKey == null) {
338
- throw new Error(ts("signer.walletAdapterDisconnected"));
339
- }
340
- if (typeof publicKey === "string") return publicKey;
341
- if ("toBase58" in publicKey && typeof publicKey.toBase58 === "function") {
342
- return publicKey.toBase58();
343
- }
344
- return String(publicKey);
345
- }
346
- function signerFromWalletAdapter(adapter, options) {
347
- const signerAddress2 = kit.address(resolveAdapterAddress(adapter));
348
- const { signTransaction } = adapter;
349
- if (typeof signTransaction !== "function") {
350
- throw new Error(ts("signer.walletAdapterNoSign"));
351
- }
352
- const { VersionedTransaction } = options;
353
- const encoder = kit.getTransactionEncoder();
354
- const decoder = kit.getTransactionDecoder();
355
- async function signOne(transaction) {
356
- const wireBytes = new Uint8Array(encoder.encode(transaction));
357
- const legacyTx = VersionedTransaction.deserialize(wireBytes);
358
- const signed = await signTransaction(legacyTx);
359
- const signedTx = decoder.decode(new Uint8Array(signed.serialize()));
360
- const signature = signedTx.signatures[signerAddress2];
361
- if (!signature) {
362
- throw new Error(
363
- ts("signer.walletNoSignature", { address: signerAddress2 })
364
- );
365
- }
366
- return signature;
367
- }
368
- return {
369
- address: signerAddress2,
370
- async signTransactions(transactions) {
371
- return Promise.all(
372
- transactions.map(async (transaction) => ({
373
- [signerAddress2]: await signOne(transaction)
374
- }))
375
- );
376
- }
377
- };
378
- }
379
- function signerFromEmbeddedWallet(connection) {
380
- const signerAddress2 = kit.address(connection.address);
381
- return {
382
- address: signerAddress2,
383
- async signTransactions(transactions) {
384
- const signatures = await connection.signTransactions(transactions);
385
- if (signatures.length !== transactions.length) {
386
- throw new Error(
387
- ts("signer.embeddedSignatureCount", {
388
- expected: transactions.length,
389
- got: signatures.length
390
- })
391
- );
392
- }
393
- return transactions.map((_, i) => ({
394
- [signerAddress2]: signatures[i]
395
- }));
396
- }
397
- };
398
- }
399
-
400
- // src/components/strings.ts
401
- var EN_COMPONENT_STRINGS = {
402
- // Shared / cross-component.
403
- "components.common.loading": "Loading\u2026",
404
- "components.common.empty": "Nothing to show yet.",
405
- "components.common.error": "Something went wrong.",
406
- "components.common.retry": "Retry",
407
- "components.common.close": "Close",
408
- "components.common.verified": "Verified",
409
- "components.common.unverified": "Unverified",
410
- "components.common.sol": "SOL",
411
- "components.common.lamports": "lamports",
412
- // ListingCard.
413
- "components.listingCard.priceLabel": "Price",
414
- "components.listingCard.byProvider": "by {provider}",
415
- "components.listingCard.untitled": "Untitled service",
416
- "components.listingCard.hires": "{count} hires",
417
- "components.listingCard.category": "Category",
418
- // ListingGrid.
419
- "components.listingGrid.empty": "No listings match your filters yet.",
420
- "components.listingGrid.loadMore": "Load more",
421
- "components.listingGrid.error": "Could not load listings.",
422
- // HireButton / Checkout.
423
- "components.hire.cta": "Hire",
424
- "components.hire.ctaPrice": "Hire \u2014 {price}",
425
- "components.hire.checkoutTitle": "Confirm hire",
426
- "components.hire.priceLabel": "You pay",
427
- "components.hire.escrowNote": "Funds are held in protocol escrow and released to the provider only when you accept the result.",
428
- "components.hire.confirm": "Confirm and fund escrow",
429
- "components.hire.cancel": "Cancel",
430
- "components.hire.pending": "Confirming\u2026",
431
- "components.hire.success": "Escrow funded.",
432
- "components.hire.successDetail": "Your task is created. Track it below.",
433
- "components.hire.viewTask": "View task",
434
- "components.hire.errorTitle": "Hire failed",
435
- "components.hire.moderationAttested": "Moderation attested",
436
- "components.hire.moderationPending": "Moderation pending",
437
- "components.hire.moderationIssues": "Moderation issues found",
438
- "components.hire.notConnected": "Connect a wallet to hire.",
439
- // Referrer disclosure.
440
- "components.referrer.disclosure": "This site earns a referral fee.",
441
- "components.referrer.disclosurePending": "Referral fee is not active for this hire.",
442
- "components.referrer.feeBps": "{bps} bps",
443
- // TaskTimeline.
444
- "components.taskTimeline.title": "Task progress",
445
- "components.taskTimeline.empty": "No task to track yet.",
446
- "components.taskTimeline.status.Open": "Open",
447
- "components.taskTimeline.status.InProgress": "In progress",
448
- "components.taskTimeline.status.PendingValidation": "Pending review",
449
- "components.taskTimeline.status.Completed": "Completed",
450
- "components.taskTimeline.status.Cancelled": "Cancelled",
451
- "components.taskTimeline.status.Disputed": "Disputed",
452
- "components.taskTimeline.status.RejectFrozen": "Rejected (frozen)",
453
- // ReviewPanel.
454
- "components.review.title": "Review submission",
455
- "components.review.noSubmission": "Awaiting the worker's submission.",
456
- "components.review.accept": "Accept and release escrow",
457
- "components.review.reject": "Reject",
458
- "components.review.requestChanges": "Request changes",
459
- "components.review.accepted": "Result accepted. Escrow released.",
460
- "components.review.rejected": "Result rejected.",
461
- "components.review.changesRequested": "Changes requested.",
462
- "components.review.pending": "Submitting\u2026",
463
- "components.review.errorTitle": "Review action failed",
464
- // DisputeBanner.
465
- "components.dispute.title": "This task is in dispute.",
466
- "components.dispute.body": "A dispute has been opened. A protocol resolver decides the outcome; funds stay in escrow until then.",
467
- "components.dispute.initiate": "Open a dispute",
468
- "components.dispute.pending": "Opening dispute\u2026",
469
- "components.dispute.opened": "Dispute opened.",
470
- "components.dispute.none": "No open dispute.",
471
- "components.dispute.errorTitle": "Could not open dispute",
472
- // ProviderCard.
473
- "components.provider.title": "Provider",
474
- "components.provider.completionRate": "Completion rate",
475
- "components.provider.disputeRate": "Dispute rate",
476
- "components.provider.completions": "{count} completed",
477
- "components.provider.disputes": "{count} disputes",
478
- "components.provider.provisional": "provisional",
479
- "components.provider.noData": "No track record yet.",
480
- "components.provider.unavailable": "Track record is unavailable on this read transport.",
481
- // Domain trust (P7.3) — VERIFIED is an on-chain attestation; CLAIMED is the
482
- // operator's self-reported metadata. The copy keeps them distinct so a buyer
483
- // never reads an unverified claim as a proven one.
484
- "components.provider.verifiedDomain": "Verified: {domain}",
485
- "components.provider.verifiedDomainLabel": "Verified domain {domain}",
486
- "components.provider.claimedDomain": "Claims: {domain}",
487
- "components.provider.claimedDomainLabel": "Claimed domain {domain} (not verified on-chain)",
488
- // GuaranteedBadge (WP-H3 Guaranteed Hire). The detail copy is deliberately
489
- // phase-1-honest: the buyer is refunded (escrow) and the worker FORFEITS the
490
- // bond — it does NOT say the buyer receives the bond, because a forfeited
491
- // bond pays the protocol treasury until phase 2 redirects it.
492
- "components.guarantee.badge": "Guaranteed \u2014 worker has 25% at stake",
493
- "components.guarantee.detail": "Worker has 25% at stake \u2014 if the result fails review you're refunded and the worker forfeits the bond.",
494
- // PoweredByAgenC.
495
- "components.poweredBy.label": "Powered by AgenC",
496
- "components.poweredBy.trustLink": "Learn how this works"
497
- };
498
- var COMPONENT_CATALOG = {
499
- ...EN_STRINGS,
500
- ...EN_COMPONENT_STRINGS
501
- };
502
-
503
- // src/components/format.ts
504
- function tc(id, vars, options) {
505
- return t(id, vars, { catalog: COMPONENT_CATALOG, ...options });
506
- }
507
- var LAMPORTS_PER_SOL = 1000000000n;
508
- function formatSol(lamports) {
509
- const negative = lamports < 0n;
510
- const abs = negative ? -lamports : lamports;
511
- const whole = abs / LAMPORTS_PER_SOL;
512
- const frac = abs % LAMPORTS_PER_SOL;
513
- let out;
514
- if (frac === 0n) {
515
- out = whole.toString();
516
- } else {
517
- const fracStr = frac.toString().padStart(9, "0").replace(/0+$/, "");
518
- out = `${whole.toString()}.${fracStr}`;
519
- }
520
- return negative ? `-${out}` : out;
521
- }
522
- function formatPriceSol(lamports, options) {
523
- return `${formatSol(lamports)} ${t("components.common.sol", void 0, {
524
- catalog: COMPONENT_CATALOG,
525
- ...options
526
- })}`;
527
- }
528
- function truncateAddress(value, head = 4, tail = 4) {
529
- if (value === null || value === void 0) return "";
530
- const s = String(value);
531
- if (s.length <= head + tail + 1) return s;
532
- return `${s.slice(0, head)}\u2026${s.slice(-tail)}`;
533
- }
534
- function decodeListingName(listing) {
535
- try {
536
- return marketplaceSdk.values.decodeListingName(Uint8Array.from(listing.name));
537
- } catch {
538
- return "";
539
- }
540
- }
541
- function decodeListingCategory(listing) {
542
- try {
543
- return marketplaceSdk.values.decodeListingCategory(Uint8Array.from(listing.category));
544
- } catch {
545
- return "";
546
- }
547
- }
548
- function decodeListingTags(listing) {
549
- try {
550
- return marketplaceSdk.values.decodeListingTags(Uint8Array.from(listing.tags));
551
- } catch {
552
- return [];
553
- }
554
- }
555
- function toHex(bytes) {
556
- let out = "";
557
- for (let i = 0; i < bytes.length; i++) {
558
- out += bytes[i].toString(16).padStart(2, "0");
559
- }
560
- return out;
561
- }
562
- function formatRate(rate, fallback = "\u2014") {
563
- if (rate === null || Number.isNaN(rate)) return fallback;
564
- const pct = Math.round(rate * 100);
565
- return `${pct}%`;
566
- }
567
- function cx(...parts) {
568
- return parts.filter((p) => Boolean(p)).join(" ");
569
- }
570
- function elementClass(base, unstyled, extra) {
571
- if (unstyled) return extra && extra.trim() !== "" ? extra : void 0;
572
- return cx(base, extra) || void 0;
573
- }
574
- function rootClass(base, unstyled, extra) {
575
- if (unstyled) return extra && extra.trim() !== "" ? extra : void 0;
576
- return cx(AGENC_THEME_CLASS, base, extra) || void 0;
577
- }
578
- var STATE_STRING = {
579
- loading: "components.common.loading",
580
- empty: "components.common.empty",
581
- error: "components.common.error"
582
- };
583
- function StateMessage({
584
- kind,
585
- message,
586
- onRetry,
587
- role,
588
- unstyled,
589
- className
590
- }) {
591
- const text = message ?? tc(STATE_STRING[kind]);
592
- const resolvedRole = role ?? (kind === "error" ? "alert" : "status");
593
- return /* @__PURE__ */ jsxRuntime.jsxs(
594
- "div",
595
- {
596
- className: elementClass(`agenc-state agenc-state--${kind}`, unstyled, className),
597
- role: resolvedRole,
598
- "aria-live": kind === "error" ? "assertive" : "polite",
599
- "aria-busy": kind === "loading" ? true : void 0,
600
- children: [
601
- kind === "loading" ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { unstyled }) : null,
602
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-state__text", children: text }),
603
- onRetry && kind !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(Button, { unstyled, variant: "ghost", onClick: onRetry, children: tc("components.common.retry") }) : null
604
- ]
605
- }
606
- );
607
- }
608
- function Spinner({ label, unstyled, className }) {
609
- return /* @__PURE__ */ jsxRuntime.jsx(
610
- "span",
611
- {
612
- className: elementClass("agenc-spinner", unstyled, className),
613
- role: "status",
614
- "aria-live": "polite",
615
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-visually-hidden", children: label ?? tc("components.common.loading") })
616
- }
617
- );
618
- }
619
- function Badge({
620
- tone = "neutral",
621
- children,
622
- label,
623
- unstyled,
624
- className
625
- }) {
626
- return /* @__PURE__ */ jsxRuntime.jsx(
627
- "span",
628
- {
629
- className: elementClass(
630
- `agenc-badge agenc-badge--${tone}`,
631
- unstyled,
632
- className
633
- ),
634
- title: label,
635
- "aria-label": label,
636
- children
637
- }
638
- );
639
- }
640
- function Button({
641
- variant = "primary",
642
- loading = false,
643
- unstyled,
644
- className,
645
- children,
646
- disabled,
647
- type,
648
- ...rest
649
- }) {
650
- return /* @__PURE__ */ jsxRuntime.jsxs(
651
- "button",
652
- {
653
- type: type ?? "button",
654
- className: elementClass(
655
- `agenc-button agenc-button--${variant}`,
656
- unstyled,
657
- className
658
- ),
659
- disabled: disabled || loading,
660
- "aria-busy": loading || void 0,
661
- ...rest,
662
- children: [
663
- loading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { unstyled }) : null,
664
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-button__label", children })
665
- ]
666
- }
667
- );
668
- }
669
- function moderationStateOf(moderation) {
670
- if (!moderation) return "pending";
671
- return moderation.metadataValid ? "attested" : "issues";
672
- }
673
- var MODERATION_TONE = {
674
- attested: "success",
675
- pending: "neutral",
676
- issues: "warning"
677
- };
678
- var MODERATION_STRING = {
679
- attested: "components.hire.moderationAttested",
680
- pending: "components.hire.moderationPending",
681
- // Distinct from `pending` ("Moderation pending") so a buyer can textually
682
- // tell "we found problems" apart from "we haven't checked", not just by tone.
683
- issues: "components.hire.moderationIssues"
684
- };
685
- function ModerationBadge({
686
- moderation,
687
- state,
688
- unstyled,
689
- className
690
- }) {
691
- const resolved = state ?? moderationStateOf(moderation);
692
- const label = tc(MODERATION_STRING[resolved]);
693
- const issues = resolved === "issues" && moderation?.metadataIssues?.length ? moderation.metadataIssues.join("; ") : void 0;
694
- return /* @__PURE__ */ jsxRuntime.jsx(
695
- Badge,
696
- {
697
- tone: MODERATION_TONE[resolved],
698
- unstyled,
699
- className,
700
- label: issues ?? label,
701
- children: label
702
- }
703
- );
704
- }
705
- function VerifiedBadge({
706
- verified,
707
- unstyled,
708
- className
709
- }) {
710
- return /* @__PURE__ */ jsxRuntime.jsx(
711
- Badge,
712
- {
713
- tone: verified ? "success" : "neutral",
714
- unstyled,
715
- className,
716
- children: verified ? tc("components.common.verified") : tc("components.common.unverified")
717
- }
718
- );
719
- }
720
-
721
- // src/hooks/internal.ts
722
- var QUERY_KEY_ROOT = "agenc";
723
- var queryKeys = {
724
- /** All listings list queries (with their filter object as the leaf). */
725
- listings: (filter) => [QUERY_KEY_ROOT, "listings", filter ?? null],
726
- /** One listing + its joined provider/track-record/moderation. */
727
- listing: (pda) => [QUERY_KEY_ROOT, "listing", pda],
728
- /** One agent's indexer track record. */
729
- agentTrackRecord: (agentPda) => [QUERY_KEY_ROOT, "agentTrackRecord", agentPda],
730
- /** One task's status (read via transport / svm decode). */
731
- taskStatus: (taskPda) => [QUERY_KEY_ROOT, "taskStatus", taskPda],
732
- /** One task's dispute record. */
733
- dispute: (taskPda) => [QUERY_KEY_ROOT, "dispute", taskPda],
734
- /** One task's completion-bond ("Guaranteed Hire") state. */
735
- taskGuarantee: (taskPda) => [QUERY_KEY_ROOT, "taskGuarantee", taskPda],
736
- /** One referrer wallet's earnings (indexer-gated; see useReferrerEarnings). */
737
- referrerEarnings: (wallet) => [QUERY_KEY_ROOT, "referrerEarnings", wallet]
738
- };
739
- function requireClient(client) {
740
- if (client === null) {
741
- throw new Error(t("provider.missingWriteClient"));
742
- }
743
- return client;
744
- }
745
- function pdaKey(pda) {
746
- return String(pda);
747
- }
748
- function resolveReferrerArgs(ctx) {
749
- const capability = ctx.resolveReferrerCapability();
750
- if (!capability.live || !capability.referrer) {
751
- return { referrerArgs: {}, referrerInjected: false };
752
- }
753
- return {
754
- referrerArgs: {
755
- referrer: capability.referrer.wallet,
756
- referrerFeeBps: capability.referrer.feeBps
757
- },
758
- referrerInjected: true
759
- };
760
- }
761
- function signerAddress(signerOrAddress) {
762
- if (typeof signerOrAddress === "string") {
763
- return signerOrAddress;
764
- }
765
- if (typeof signerOrAddress === "object" && signerOrAddress !== null && "address" in signerOrAddress && typeof signerOrAddress.address === "string") {
766
- return signerOrAddress.address;
767
- }
768
- throw new Error("Expected a TransactionSigner or Address with an address field.");
769
- }
770
- function withoutReferrerArgs(input) {
771
- const {
772
- referrer: _referrer,
773
- referrerFeeBps: _referrerFeeBps,
774
- ...rest
775
- } = input;
776
- return rest;
777
- }
778
-
779
- // src/hooks/useTaskGuarantee.ts
780
- function useTaskGuarantee(taskPda, options) {
781
- const ctx = useAgencContext();
782
- const injected = options?.guaranteeReader;
783
- const rpcUrl = ctx.rpcUrl;
784
- const reader = react.useMemo(() => {
785
- if (injected) return injected;
786
- if (!rpcUrl) return null;
787
- return (pda) => marketplaceSdk.fetchTaskGuarantee(
788
- kit.createSolanaRpc(rpcUrl),
789
- pda
790
- );
791
- }, [injected, rpcUrl]);
792
- const enabled = (options?.enabled ?? true) && Boolean(taskPda) && reader !== null;
793
- const query = reactQuery.useQuery({
794
- queryKey: queryKeys.taskGuarantee(taskPda ? pdaKey(taskPda) : ""),
795
- enabled,
796
- queryFn: () => reader(taskPda)
797
- });
798
- const guarantee = query.data ?? null;
799
- return {
800
- guarantee,
801
- guaranteed: guarantee?.guaranteed ?? false,
802
- isLoading: query.isLoading,
803
- error: query.error ?? null,
804
- refetch: () => void query.refetch()
805
- };
806
- }
807
- function GuaranteedBadge({
808
- task,
809
- guarantee,
810
- guaranteeReader,
811
- unstyled,
812
- className
813
- }) {
814
- const overridden = guarantee !== void 0;
815
- const read = useTaskGuarantee(overridden ? null : task, {
816
- guaranteeReader,
817
- enabled: !overridden
818
- });
819
- const resolved = overridden ? guarantee : read.guarantee;
820
- if (!resolved?.guaranteed) return null;
821
- return /* @__PURE__ */ jsxRuntime.jsx(
822
- Badge,
823
- {
824
- tone: "success",
825
- unstyled,
826
- className,
827
- label: tc("components.guarantee.detail"),
828
- children: tc("components.guarantee.badge")
829
- }
830
- );
831
- }
832
- var FOCUSABLE_SELECTOR = [
833
- "a[href]",
834
- "button:not([disabled])",
835
- "textarea:not([disabled])",
836
- "input:not([disabled])",
837
- "select:not([disabled])",
838
- '[tabindex]:not([tabindex="-1"])'
839
- ].join(",");
840
- function focusableWithin(container) {
841
- return Array.from(
842
- container.querySelectorAll(FOCUSABLE_SELECTOR)
843
- ).filter((el) => el.offsetParent !== null || el === document.activeElement);
844
- }
845
- function useFocusTrap(containerRef, active, onEscape) {
846
- react.useEffect(() => {
847
- if (!active) return;
848
- const container = containerRef.current;
849
- if (!container) return;
850
- const previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
851
- const initial = focusableWithin(container)[0] ?? container;
852
- initial.focus();
853
- function onKeyDown(event) {
854
- if (event.key === "Escape") {
855
- event.stopPropagation();
856
- onEscape?.();
857
- return;
858
- }
859
- if (event.key !== "Tab") return;
860
- const focusable = focusableWithin(container);
861
- if (focusable.length === 0) {
862
- event.preventDefault();
863
- container.focus();
864
- return;
865
- }
866
- const first = focusable[0];
867
- const last = focusable[focusable.length - 1];
868
- const activeEl = document.activeElement;
869
- if (event.shiftKey) {
870
- if (activeEl === first || activeEl === container) {
871
- event.preventDefault();
872
- last.focus();
873
- }
874
- } else if (activeEl === last) {
875
- event.preventDefault();
876
- first.focus();
877
- }
878
- }
879
- function onFocusIn(event) {
880
- const target = event.target;
881
- if (!(target instanceof Node)) return;
882
- if (container.contains(target)) return;
883
- event.stopPropagation();
884
- const focusable = focusableWithin(container);
885
- (focusable[0] ?? container).focus();
886
- }
887
- container.addEventListener("keydown", onKeyDown);
888
- document.addEventListener("focusin", onFocusIn);
889
- return () => {
890
- container.removeEventListener("keydown", onKeyDown);
891
- document.removeEventListener("focusin", onFocusIn);
892
- previouslyFocused?.focus();
893
- };
894
- }, [containerRef, active, onEscape]);
895
- }
896
- function Modal({
897
- open,
898
- onClose,
899
- title,
900
- children,
901
- footer,
902
- disableEscapeClose = false,
903
- disableOverlayClose = false,
904
- hideCloseButton = false,
905
- closeLabel,
906
- unstyled,
907
- className
908
- }) {
909
- const dialogRef = react.useRef(null);
910
- const titleId = react.useId();
911
- const bodyId = react.useId();
912
- useFocusTrap(dialogRef, open, () => {
913
- if (!disableEscapeClose) onClose();
914
- });
915
- if (!open) return null;
916
- const overlayClass = rootClass("agenc-modal", unstyled, className);
917
- return /* @__PURE__ */ jsxRuntime.jsx(
918
- "div",
919
- {
920
- className: overlayClass,
921
- onMouseDown: (event) => {
922
- if (disableOverlayClose) return;
923
- if (event.target === event.currentTarget) onClose();
924
- },
925
- children: /* @__PURE__ */ jsxRuntime.jsxs(
926
- "div",
927
- {
928
- className: unstyled ? void 0 : "agenc-modal__dialog",
929
- ref: dialogRef,
930
- role: "dialog",
931
- "aria-modal": "true",
932
- "aria-labelledby": titleId,
933
- "aria-describedby": bodyId,
934
- tabIndex: -1,
935
- children: [
936
- /* @__PURE__ */ jsxRuntime.jsxs("header", { className: unstyled ? void 0 : "agenc-modal__header", children: [
937
- /* @__PURE__ */ jsxRuntime.jsx("h2", { id: titleId, className: unstyled ? void 0 : "agenc-modal__title", children: title }),
938
- hideCloseButton ? null : /* @__PURE__ */ jsxRuntime.jsx(
939
- "button",
940
- {
941
- type: "button",
942
- className: unstyled ? void 0 : "agenc-modal__close",
943
- "aria-label": closeLabel ?? tc("components.common.close"),
944
- onClick: onClose,
945
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "\xD7" })
946
- }
947
- )
948
- ] }),
949
- /* @__PURE__ */ jsxRuntime.jsx("div", { id: bodyId, className: unstyled ? void 0 : "agenc-modal__body", children }),
950
- footer ? /* @__PURE__ */ jsxRuntime.jsx("footer", { className: unstyled ? void 0 : "agenc-modal__footer", children: footer }) : null
951
- ]
952
- }
953
- )
954
- }
955
- );
956
- }
957
- function ListingCard({
958
- listing,
959
- moderation,
960
- onHire,
961
- onSelect,
962
- hidePrice = false,
963
- unstyled,
964
- className
965
- }) {
966
- const { account } = listing;
967
- const name = decodeListingName(account) || tc("components.listingCard.untitled");
968
- const category = decodeListingCategory(account);
969
- const price = formatPriceSol(account.price);
970
- const provider = truncateAddress(account.providerAgent);
971
- const hires = account.totalHires;
972
- const cardClass = rootClass("agenc-listing-card", unstyled, className);
973
- const selectable = Boolean(onSelect);
974
- const heading = /* @__PURE__ */ jsxRuntime.jsx("h3", { className: unstyled ? void 0 : "agenc-listing-card__title", children: name });
975
- return /* @__PURE__ */ jsxRuntime.jsxs(
976
- "article",
977
- {
978
- className: cardClass,
979
- "aria-label": name,
980
- children: [
981
- /* @__PURE__ */ jsxRuntime.jsxs("header", { className: unstyled ? void 0 : "agenc-listing-card__header", children: [
982
- selectable ? /* @__PURE__ */ jsxRuntime.jsx(
983
- "button",
984
- {
985
- type: "button",
986
- className: unstyled ? void 0 : "agenc-listing-card__title-button",
987
- onClick: () => onSelect?.(listing),
988
- children: heading
989
- }
990
- ) : heading,
991
- /* @__PURE__ */ jsxRuntime.jsx(ModerationBadge, { moderation, unstyled })
992
- ] }),
993
- /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: unstyled ? void 0 : "agenc-listing-card__meta", children: [
994
- category ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-listing-card__meta-row", children: [
995
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: tc("components.listingCard.category") }),
996
- /* @__PURE__ */ jsxRuntime.jsx("dd", { children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { tone: "info", unstyled, children: category }) })
997
- ] }) : null,
998
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-listing-card__meta-row", children: [
999
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: tc("components.listingCard.byProvider", { provider }) }),
1000
- /* @__PURE__ */ jsxRuntime.jsx("dd", { children: tc("components.listingCard.hires", { count: String(hires) }) })
1001
- ] })
1002
- ] }),
1003
- /* @__PURE__ */ jsxRuntime.jsxs("footer", { className: unstyled ? void 0 : "agenc-listing-card__footer", children: [
1004
- hidePrice ? null : /* @__PURE__ */ jsxRuntime.jsxs("p", { className: unstyled ? void 0 : "agenc-listing-card__price", children: [
1005
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-listing-card__price-label", children: tc("components.listingCard.priceLabel") }),
1006
- " ",
1007
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-listing-card__price-value", children: price })
1008
- ] }),
1009
- onHire ? /* @__PURE__ */ jsxRuntime.jsx(
1010
- Button,
1011
- {
1012
- unstyled,
1013
- variant: "primary",
1014
- onClick: () => onHire(listing),
1015
- children: tc("components.hire.cta")
1016
- }
1017
- ) : null
1018
- ] })
1019
- ]
1020
- }
1021
- );
1022
- }
1023
- function ListingGrid({
1024
- listings,
1025
- isLoading = false,
1026
- error = null,
1027
- hasMore = false,
1028
- onLoadMore,
1029
- onRetry,
1030
- onHire,
1031
- onSelect,
1032
- moderationByPda,
1033
- emptyMessage,
1034
- unstyled,
1035
- className
1036
- }) {
1037
- const gridClass = rootClass("agenc-listing-grid", unstyled, className);
1038
- if (error) {
1039
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: gridClass, children: /* @__PURE__ */ jsxRuntime.jsx(
1040
- StateMessage,
1041
- {
1042
- kind: "error",
1043
- message: tc("components.listingGrid.error"),
1044
- onRetry,
1045
- unstyled
1046
- }
1047
- ) });
1048
- }
1049
- if (isLoading && listings.length === 0) {
1050
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: gridClass, children: /* @__PURE__ */ jsxRuntime.jsx(StateMessage, { kind: "loading", unstyled }) });
1051
- }
1052
- if (listings.length === 0) {
1053
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: gridClass, children: /* @__PURE__ */ jsxRuntime.jsx(
1054
- StateMessage,
1055
- {
1056
- kind: "empty",
1057
- message: emptyMessage ?? tc("components.listingGrid.empty"),
1058
- unstyled
1059
- }
1060
- ) });
1061
- }
1062
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: gridClass, children: [
1063
- /* @__PURE__ */ jsxRuntime.jsx(
1064
- "ul",
1065
- {
1066
- className: unstyled ? void 0 : "agenc-listing-grid__list",
1067
- children: listings.map((listing) => /* @__PURE__ */ jsxRuntime.jsx(
1068
- "li",
1069
- {
1070
- className: unstyled ? void 0 : "agenc-listing-grid__item",
1071
- children: /* @__PURE__ */ jsxRuntime.jsx(
1072
- ListingCard,
1073
- {
1074
- listing,
1075
- moderation: moderationByPda?.[String(listing.address)] ?? null,
1076
- onHire,
1077
- onSelect,
1078
- unstyled
1079
- }
1080
- )
1081
- },
1082
- String(listing.address)
1083
- ))
1084
- }
1085
- ),
1086
- hasMore && onLoadMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: unstyled ? void 0 : "agenc-listing-grid__more", children: /* @__PURE__ */ jsxRuntime.jsx(
1087
- "button",
1088
- {
1089
- type: "button",
1090
- className: unstyled ? void 0 : "agenc-button agenc-button--secondary",
1091
- onClick: onLoadMore,
1092
- children: tc("components.listingGrid.loadMore")
1093
- }
1094
- ) }) : null
1095
- ] });
1096
- }
1097
- function readRpc(input) {
1098
- return input.rpc ?? (input.rpcUrl ? kit.createSolanaRpc(input.rpcUrl) : null);
1099
- }
1100
- async function resolveRosterEntry(rpc, moderator) {
1101
- const [moderationConfigPda] = await marketplaceSdk.findModerationConfigPda();
1102
- const moderationConfig = await marketplaceSdk.fetchMaybeModerationConfig(
1103
- rpc,
1104
- moderationConfigPda
1105
- );
1106
- if (moderationConfig.exists && moderationConfig.data.moderationAuthority === moderator) {
1107
- return void 0;
1108
- }
1109
- const [rosterPda] = await marketplaceSdk.findModerationAttestorPda({ attestor: moderator });
1110
- const roster = await marketplaceSdk.fetchMaybeModerationAttestor(rpc, rosterPda);
1111
- return roster.exists ? rosterPda : void 0;
1112
- }
1113
- async function resolveHireListingModerationAccounts(input) {
1114
- try {
1115
- const rpc = readRpc(input);
1116
- if (!rpc) return {};
1117
- const moderationAttestor = await resolveRosterEntry(rpc, input.moderator);
1118
- const attestorPart = moderationAttestor !== void 0 ? { moderationAttestor } : {};
1119
- const [v2Pda] = await marketplaceSdk.findListingModerationPda({
1120
- listing: input.listing,
1121
- jobSpecHash: input.listingSpecHash,
1122
- moderator: input.moderator
1123
- });
1124
- const v2 = await marketplaceSdk.fetchMaybeListingModeration(rpc, v2Pda);
1125
- if (v2.exists) return attestorPart;
1126
- const [legacyPda] = await marketplaceSdk.facade.findLegacyListingModerationPda({
1127
- listing: input.listing,
1128
- jobSpecHash: input.listingSpecHash
1129
- });
1130
- const legacy = await marketplaceSdk.fetchMaybeListingModeration(rpc, legacyPda);
1131
- if (legacy.exists && legacy.data.moderator === input.moderator) {
1132
- return { ...attestorPart, listingModeration: legacyPda };
1133
- }
1134
- return attestorPart;
1135
- } catch {
1136
- return {};
1137
- }
192
+ return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntime.jsx(chunkJTSG5FGC_cjs.AgencContext.Provider, { value, children }) });
1138
193
  }
1139
194
 
1140
- // src/hooks/useHire.ts
1141
- function useHire() {
1142
- const ctx = useAgencContext();
1143
- const mutation = reactQuery.useMutation({
1144
- mutationFn: async (input) => {
1145
- const client = requireClient(ctx.client);
1146
- const { referrerArgs, referrerInjected } = resolveReferrerArgs(ctx);
1147
- const hireInput = withoutReferrerArgs(input);
1148
- const listingSpecHash = input.listingSpecHash;
1149
- let moderationArgs = {};
1150
- if (input.moderationAttestor === void 0 && input.moderatorIsAttestor === void 0 && input.listingModeration === void 0 && listingSpecHash !== void 0) {
1151
- moderationArgs = await resolveHireListingModerationAccounts({
1152
- rpcUrl: ctx.rpcUrl,
1153
- listing: input.listing,
1154
- listingSpecHash,
1155
- moderator: input.moderator
1156
- });
1157
- }
1158
- const creator = input.creator ?? client.signer;
1159
- let signature;
1160
- if (input.humanless === true) {
1161
- const result = await client.hireFromListingHumanless({
1162
- ...hireInput,
1163
- ...moderationArgs,
1164
- creator,
1165
- ...referrerArgs
1166
- });
1167
- signature = result.signature;
1168
- } else {
1169
- const authority = input.authority ?? client.signer;
1170
- const result = await client.hireFromListing({
1171
- ...hireInput,
1172
- ...moderationArgs,
1173
- authority,
1174
- creator,
1175
- ...referrerArgs
1176
- });
1177
- signature = result.signature;
1178
- }
1179
- const [taskPda] = await marketplaceSdk.findTaskPda({
1180
- creator: signerAddress(creator),
1181
- taskId: input.taskId
1182
- });
1183
- return { signature, taskPda, referrerInjected };
1184
- }
1185
- });
1186
- const hire = react.useCallback(
1187
- (input) => mutation.mutateAsync(input),
1188
- [mutation]
1189
- );
1190
- const status = react.useMemo(() => {
1191
- if (mutation.isPending) return "pending";
1192
- if (mutation.isError) return "error";
1193
- if (mutation.isSuccess) return "success";
1194
- return "idle";
1195
- }, [mutation.isPending, mutation.isError, mutation.isSuccess]);
1196
- return {
1197
- hire,
1198
- status,
1199
- taskPda: mutation.data?.taskPda ?? null,
1200
- signature: mutation.data?.signature ?? null,
1201
- error: mutation.error ?? null,
1202
- isPending: mutation.isPending,
1203
- reset: mutation.reset
1204
- };
1205
- }
1206
- function useWalletSigner(options) {
1207
- const ctx = useAgencContext();
1208
- const adapter = options?.adapter;
1209
- const signer = ctx.signer ?? null;
1210
- const connected = adapter !== void 0 ? adapter.connected ?? adapter.signer !== null : ctx.signer !== null;
1211
- const connect = react.useCallback(() => {
1212
- return void 0;
1213
- }, [adapter]);
1214
- return { signer, connected, connect };
1215
- }
1216
- function ReferrerDisclosure({
1217
- referrer,
1218
- live = false,
1219
- showFee = true,
1220
- unstyled,
1221
- className
1222
- }) {
1223
- const text = live ? tc("components.referrer.disclosure") : tc("components.referrer.disclosurePending");
1224
- return /* @__PURE__ */ jsxRuntime.jsxs(
1225
- "p",
1226
- {
1227
- className: unstyled ? className : cx("agenc-referrer-disclosure", className),
1228
- role: "note",
1229
- children: [
1230
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: text }),
1231
- showFee ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: unstyled ? void 0 : "agenc-referrer-disclosure__fee", children: [
1232
- " ",
1233
- tc("components.referrer.feeBps", { bps: String(referrer.feeBps) })
1234
- ] }) : null
1235
- ]
1236
- }
1237
- );
1238
- }
1239
- function HireCheckoutModal({
1240
- open,
1241
- onClose,
1242
- listing,
1243
- onConfirm,
1244
- status = "idle",
1245
- error = null,
1246
- taskPda = null,
1247
- onViewTask,
1248
- moderation,
1249
- referrer,
1250
- referrerLive = false,
1251
- connected = true,
1252
- unstyled,
1253
- className
1254
- }) {
1255
- const pending = status === "pending";
1256
- const success = status === "success";
1257
- const price = formatPriceSol(listing.account.price);
1258
- const [submitting, setSubmitting] = react.useState(false);
1259
- const submittingRef = react.useRef(false);
1260
- react.useEffect(() => {
1261
- if (!open || !pending) {
1262
- submittingRef.current = false;
1263
- setSubmitting(false);
1264
- }
1265
- }, [open, pending]);
1266
- const handleConfirm = react.useCallback(() => {
1267
- if (submittingRef.current) return;
1268
- submittingRef.current = true;
1269
- setSubmitting(true);
1270
- let result;
1271
- try {
1272
- result = onConfirm();
1273
- } catch {
1274
- submittingRef.current = false;
1275
- setSubmitting(false);
1276
- return;
1277
- }
1278
- if (result && typeof result.then === "function") {
1279
- void result.finally(() => {
1280
- submittingRef.current = false;
1281
- setSubmitting(false);
1282
- });
1283
- }
1284
- }, [onConfirm]);
1285
- const confirmDisabled = !connected || pending || submitting;
1286
- const lockClose = pending || submitting;
1287
- const footer = success ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1288
- taskPda && onViewTask ? /* @__PURE__ */ jsxRuntime.jsx(
1289
- Button,
1290
- {
1291
- unstyled,
1292
- variant: "primary",
1293
- onClick: () => onViewTask(taskPda),
1294
- children: tc("components.hire.viewTask")
1295
- }
1296
- ) : null,
1297
- /* @__PURE__ */ jsxRuntime.jsx(Button, { unstyled, variant: "secondary", onClick: onClose, children: tc("components.common.close") })
1298
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1299
- /* @__PURE__ */ jsxRuntime.jsx(
1300
- Button,
1301
- {
1302
- unstyled,
1303
- variant: "secondary",
1304
- onClick: onClose,
1305
- disabled: pending || submitting,
1306
- children: tc("components.hire.cancel")
1307
- }
1308
- ),
1309
- /* @__PURE__ */ jsxRuntime.jsx(
1310
- Button,
1311
- {
1312
- unstyled,
1313
- variant: "primary",
1314
- loading: pending || submitting,
1315
- disabled: confirmDisabled,
1316
- onClick: handleConfirm,
1317
- children: pending || submitting ? tc("components.hire.pending") : tc("components.hire.confirm")
1318
- }
1319
- )
1320
- ] });
1321
- return /* @__PURE__ */ jsxRuntime.jsx(
1322
- Modal,
1323
- {
1324
- open,
1325
- onClose,
1326
- title: tc("components.hire.checkoutTitle"),
1327
- footer,
1328
- disableEscapeClose: lockClose,
1329
- disableOverlayClose: lockClose,
1330
- hideCloseButton: lockClose,
1331
- unstyled,
1332
- className,
1333
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-checkout", children: [
1334
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-checkout__row", children: [
1335
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-checkout__price-label", children: tc("components.hire.priceLabel") }),
1336
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-checkout__price", children: price })
1337
- ] }),
1338
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: unstyled ? void 0 : "agenc-checkout__moderation", children: /* @__PURE__ */ jsxRuntime.jsx(ModerationBadge, { moderation, unstyled }) }),
1339
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: unstyled ? void 0 : "agenc-checkout__escrow-note", children: tc("components.hire.escrowNote") }),
1340
- referrer ? /* @__PURE__ */ jsxRuntime.jsx(
1341
- ReferrerDisclosure,
1342
- {
1343
- referrer,
1344
- live: referrerLive,
1345
- unstyled
1346
- }
1347
- ) : null,
1348
- /* @__PURE__ */ jsxRuntime.jsxs(
1349
- "div",
1350
- {
1351
- className: unstyled ? void 0 : "agenc-checkout__status",
1352
- role: "status",
1353
- "aria-live": "polite",
1354
- children: [
1355
- pending ? tc("components.hire.pending") : null,
1356
- success ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1357
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: tc("components.hire.success") }),
1358
- " ",
1359
- tc("components.hire.successDetail")
1360
- ] }) : null
1361
- ]
1362
- }
1363
- ),
1364
- error ? /* @__PURE__ */ jsxRuntime.jsxs(
1365
- "div",
1366
- {
1367
- className: unstyled ? void 0 : "agenc-checkout__error",
1368
- role: "alert",
1369
- "aria-live": "assertive",
1370
- children: [
1371
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: tc("components.hire.errorTitle") }),
1372
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: error.message })
1373
- ]
1374
- }
1375
- ) : null,
1376
- !connected && !success ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: unstyled ? void 0 : "agenc-checkout__hint", children: tc("components.hire.notConnected") }) : null
1377
- ] })
1378
- }
1379
- );
1380
- }
1381
- function HireButton({
1382
- listing,
1383
- buildHireInput,
1384
- onHired,
1385
- onViewTask,
1386
- showPriceInLabel = true,
1387
- label,
1388
- unstyled,
1389
- className
1390
- }) {
1391
- const ctx = useAgencContext();
1392
- const { hire, status, error, taskPda, reset } = useHire();
1393
- const { connected } = useWalletSigner();
1394
- const [open, setOpen] = react.useState(false);
1395
- const inFlightRef = react.useRef(false);
1396
- const capability = ctx.resolveReferrerCapability();
1397
- const close = react.useCallback(() => {
1398
- setOpen(false);
1399
- inFlightRef.current = false;
1400
- reset();
1401
- }, [reset]);
1402
- const confirm = react.useCallback(async () => {
1403
- if (inFlightRef.current) return;
1404
- inFlightRef.current = true;
1405
- try {
1406
- const input = buildHireInput(listing);
1407
- const result = await hire(input);
1408
- onHired?.(result.taskPda);
1409
- } finally {
1410
- inFlightRef.current = false;
1411
- }
1412
- }, [buildHireInput, hire, listing, onHired]);
1413
- const buttonLabel = label ?? (showPriceInLabel ? tc("components.hire.ctaPrice", {
1414
- price: formatPriceSol(listing.account.price)
1415
- }) : tc("components.hire.cta"));
1416
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1417
- /* @__PURE__ */ jsxRuntime.jsx(
1418
- Button,
1419
- {
1420
- unstyled,
1421
- className,
1422
- variant: "primary",
1423
- onClick: () => setOpen(true),
1424
- children: buttonLabel
1425
- }
1426
- ),
1427
- /* @__PURE__ */ jsxRuntime.jsx(
1428
- HireCheckoutModal,
1429
- {
1430
- open,
1431
- onClose: close,
1432
- listing,
1433
- onConfirm: confirm,
1434
- status,
1435
- error,
1436
- taskPda,
1437
- onViewTask,
1438
- referrer: ctx.referrer,
1439
- referrerLive: capability.live,
1440
- connected,
1441
- unstyled
1442
- }
1443
- )
1444
- ] });
1445
- }
1446
- var HAPPY_PATH = [
1447
- { status: marketplaceSdk.TaskStatus.Open, stringId: "components.taskTimeline.status.Open" },
1448
- {
1449
- status: marketplaceSdk.TaskStatus.InProgress,
1450
- stringId: "components.taskTimeline.status.InProgress"
1451
- },
1452
- {
1453
- status: marketplaceSdk.TaskStatus.PendingValidation,
1454
- stringId: "components.taskTimeline.status.PendingValidation"
1455
- },
1456
- {
1457
- status: marketplaceSdk.TaskStatus.Completed,
1458
- stringId: "components.taskTimeline.status.Completed"
1459
- }
1460
- ];
1461
- var OFF_PATH = {
1462
- [marketplaceSdk.TaskStatus.Cancelled]: {
1463
- stringId: "components.taskTimeline.status.Cancelled",
1464
- tone: "cancelled"
1465
- },
1466
- [marketplaceSdk.TaskStatus.Disputed]: {
1467
- stringId: "components.taskTimeline.status.Disputed",
1468
- tone: "disputed"
1469
- },
1470
- [marketplaceSdk.TaskStatus.RejectFrozen]: {
1471
- stringId: "components.taskTimeline.status.RejectFrozen",
1472
- tone: "rejected"
1473
- }
1474
- };
1475
- function happyIndex(status) {
1476
- return HAPPY_PATH.findIndex((s) => s.status === status);
1477
- }
1478
- function TaskTimeline({
1479
- status,
1480
- isLoading = false,
1481
- error = null,
1482
- onRetry,
1483
- unstyled,
1484
- className
1485
- }) {
1486
- const timelineClass = rootClass("agenc-timeline", unstyled, className);
1487
- if (error) {
1488
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: timelineClass, children: /* @__PURE__ */ jsxRuntime.jsx(StateMessage, { kind: "error", onRetry, unstyled }) });
1489
- }
1490
- if (isLoading && status === null) {
1491
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: timelineClass, children: /* @__PURE__ */ jsxRuntime.jsx(StateMessage, { kind: "loading", unstyled }) });
1492
- }
1493
- if (status === null) {
1494
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: timelineClass, children: /* @__PURE__ */ jsxRuntime.jsx(
1495
- StateMessage,
1496
- {
1497
- kind: "empty",
1498
- message: tc("components.taskTimeline.empty"),
1499
- unstyled
1500
- }
1501
- ) });
1502
- }
1503
- const offPath = OFF_PATH[status];
1504
- const currentIndex = offPath ? -1 : happyIndex(status);
1505
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: timelineClass, "aria-label": tc("components.taskTimeline.title"), children: [
1506
- /* @__PURE__ */ jsxRuntime.jsx("ol", { className: unstyled ? void 0 : "agenc-timeline__list", children: HAPPY_PATH.map((stage, index) => {
1507
- const done = currentIndex > index;
1508
- const current = currentIndex === index;
1509
- const state = done ? "done" : current ? "current" : "upcoming";
1510
- return /* @__PURE__ */ jsxRuntime.jsxs(
1511
- "li",
1512
- {
1513
- className: unstyled ? void 0 : cx("agenc-timeline__step", `agenc-timeline__step--${state}`),
1514
- "aria-current": current ? "step" : void 0,
1515
- children: [
1516
- /* @__PURE__ */ jsxRuntime.jsx(
1517
- "span",
1518
- {
1519
- className: unstyled ? void 0 : "agenc-timeline__marker",
1520
- "aria-hidden": "true"
1521
- }
1522
- ),
1523
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-timeline__label", children: tc(stage.stringId) })
1524
- ]
1525
- },
1526
- stage.status
1527
- );
1528
- }) }),
1529
- offPath ? /* @__PURE__ */ jsxRuntime.jsx(
1530
- "p",
1531
- {
1532
- className: unstyled ? void 0 : cx(
1533
- "agenc-timeline__terminal",
1534
- `agenc-timeline__terminal--${offPath.tone}`
1535
- ),
1536
- role: "status",
1537
- children: tc(offPath.stringId)
1538
- }
1539
- ) : null
1540
- ] });
1541
- }
1542
- var SUCCESS_STRING = {
1543
- accept: "components.review.accepted",
1544
- reject: "components.review.rejected",
1545
- requestChanges: "components.review.changesRequested"
1546
- };
1547
- function ReviewPanel({
1548
- hasSubmission = false,
1549
- onAccept,
1550
- onReject,
1551
- onRequestChanges,
1552
- status = "idle",
1553
- error = null,
1554
- settledAction,
1555
- unstyled,
1556
- className
1557
- }) {
1558
- const panelClass = rootClass("agenc-review", unstyled, className);
1559
- const pending = status === "pending";
1560
- const success = status === "success";
1561
- return /* @__PURE__ */ jsxRuntime.jsxs(
1562
- "section",
1563
- {
1564
- className: panelClass,
1565
- "aria-label": tc("components.review.title"),
1566
- children: [
1567
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: unstyled ? void 0 : "agenc-review__title", children: tc("components.review.title") }),
1568
- !hasSubmission ? /* @__PURE__ */ jsxRuntime.jsx(
1569
- StateMessage,
1570
- {
1571
- kind: "empty",
1572
- message: tc("components.review.noSubmission"),
1573
- unstyled
1574
- }
1575
- ) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-review__actions", children: [
1576
- /* @__PURE__ */ jsxRuntime.jsx(
1577
- Button,
1578
- {
1579
- unstyled,
1580
- variant: "primary",
1581
- loading: pending,
1582
- disabled: pending || !onAccept,
1583
- onClick: onAccept,
1584
- children: tc("components.review.accept")
1585
- }
1586
- ),
1587
- /* @__PURE__ */ jsxRuntime.jsx(
1588
- Button,
1589
- {
1590
- unstyled,
1591
- variant: "secondary",
1592
- disabled: pending || !onRequestChanges,
1593
- onClick: onRequestChanges,
1594
- children: tc("components.review.requestChanges")
1595
- }
1596
- ),
1597
- /* @__PURE__ */ jsxRuntime.jsx(
1598
- Button,
1599
- {
1600
- unstyled,
1601
- variant: "danger",
1602
- disabled: pending || !onReject,
1603
- onClick: onReject,
1604
- children: tc("components.review.reject")
1605
- }
1606
- )
1607
- ] }),
1608
- /* @__PURE__ */ jsxRuntime.jsxs(
1609
- "div",
1610
- {
1611
- className: unstyled ? void 0 : "agenc-review__status",
1612
- role: "status",
1613
- "aria-live": "polite",
1614
- children: [
1615
- pending ? tc("components.review.pending") : null,
1616
- success && settledAction ? tc(SUCCESS_STRING[settledAction]) : null
1617
- ]
1618
- }
1619
- ),
1620
- error ? /* @__PURE__ */ jsxRuntime.jsxs(
1621
- "div",
1622
- {
1623
- className: unstyled ? void 0 : "agenc-review__error",
1624
- role: "alert",
1625
- "aria-live": "assertive",
1626
- children: [
1627
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: tc("components.review.errorTitle") }),
1628
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: error.message })
1629
- ]
1630
- }
1631
- ) : null
1632
- ]
1633
- }
1634
- );
1635
- }
1636
- function DisputeBanner({
1637
- disputeOpen = false,
1638
- onInitiate,
1639
- status = "idle",
1640
- error = null,
1641
- unstyled,
1642
- className
1643
- }) {
1644
- const bannerClass = rootClass(
1645
- cx(
1646
- "agenc-dispute",
1647
- disputeOpen ? "agenc-dispute--open" : "agenc-dispute--none"
1648
- ),
1649
- unstyled,
1650
- className
1651
- );
1652
- const pending = status === "pending";
1653
- const opened = status === "success";
1654
- if (disputeOpen) {
1655
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: bannerClass, role: "alert", children: [
1656
- /* @__PURE__ */ jsxRuntime.jsx("strong", { className: unstyled ? void 0 : "agenc-dispute__title", children: tc("components.dispute.title") }),
1657
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: unstyled ? void 0 : "agenc-dispute__body", children: tc("components.dispute.body") })
1658
- ] });
1659
- }
1660
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: bannerClass, role: "region", "aria-label": tc("components.dispute.none"), children: [
1661
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: unstyled ? void 0 : "agenc-dispute__none", children: tc("components.dispute.none") }),
1662
- onInitiate ? /* @__PURE__ */ jsxRuntime.jsx(
1663
- Button,
1664
- {
1665
- unstyled,
1666
- variant: "secondary",
1667
- loading: pending,
1668
- disabled: pending,
1669
- onClick: onInitiate,
1670
- children: pending ? tc("components.dispute.pending") : tc("components.dispute.initiate")
1671
- }
1672
- ) : null,
1673
- /* @__PURE__ */ jsxRuntime.jsx(
1674
- "div",
1675
- {
1676
- className: unstyled ? void 0 : "agenc-dispute__status",
1677
- role: "status",
1678
- "aria-live": "polite",
1679
- children: opened ? tc("components.dispute.opened") : null
1680
- }
1681
- ),
1682
- error ? /* @__PURE__ */ jsxRuntime.jsxs(
1683
- "div",
1684
- {
1685
- className: unstyled ? void 0 : "agenc-dispute__error",
1686
- role: "alert",
1687
- "aria-live": "assertive",
1688
- children: [
1689
- /* @__PURE__ */ jsxRuntime.jsx("strong", { children: tc("components.dispute.errorTitle") }),
1690
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: error.message })
1691
- ]
1692
- }
1693
- ) : null
1694
- ] });
1695
- }
1696
- var UNVERIFIED = Object.freeze({
1697
- verified: false
195
+ Object.defineProperty(exports, "ReadTransportUnsupportedError", {
196
+ enumerable: true,
197
+ get: function () { return chunkONC6L3IX_cjs.ReadTransportUnsupportedError; }
198
+ });
199
+ Object.defineProperty(exports, "createReadTransport", {
200
+ enumerable: true,
201
+ get: function () { return chunkONC6L3IX_cjs.createReadTransport; }
202
+ });
203
+ Object.defineProperty(exports, "EN_SIGNER_STRINGS", {
204
+ enumerable: true,
205
+ get: function () { return chunkR76EUYDI_cjs.EN_SIGNER_STRINGS; }
206
+ });
207
+ Object.defineProperty(exports, "signerFromEmbeddedWallet", {
208
+ enumerable: true,
209
+ get: function () { return chunkR76EUYDI_cjs.signerFromEmbeddedWallet; }
210
+ });
211
+ Object.defineProperty(exports, "signerFromWalletAccount", {
212
+ enumerable: true,
213
+ get: function () { return chunkR76EUYDI_cjs.signerFromWalletAccount; }
214
+ });
215
+ Object.defineProperty(exports, "signerFromWalletAdapter", {
216
+ enumerable: true,
217
+ get: function () { return chunkR76EUYDI_cjs.signerFromWalletAdapter; }
218
+ });
219
+ Object.defineProperty(exports, "walletStandardChainForNetwork", {
220
+ enumerable: true,
221
+ get: function () { return chunkR76EUYDI_cjs.walletStandardChainForNetwork; }
222
+ });
223
+ Object.defineProperty(exports, "AGENC_THEME_CLASS", {
224
+ enumerable: true,
225
+ get: function () { return chunkIJKWKY4H_cjs.AGENC_THEME_CLASS; }
226
+ });
227
+ Object.defineProperty(exports, "AGENC_TOKENS_CSS_PATH", {
228
+ enumerable: true,
229
+ get: function () { return chunkIJKWKY4H_cjs.AGENC_TOKENS_CSS_PATH; }
230
+ });
231
+ Object.defineProperty(exports, "Badge", {
232
+ enumerable: true,
233
+ get: function () { return chunkIJKWKY4H_cjs.Badge; }
234
+ });
235
+ Object.defineProperty(exports, "Button", {
236
+ enumerable: true,
237
+ get: function () { return chunkIJKWKY4H_cjs.Button; }
238
+ });
239
+ Object.defineProperty(exports, "COMPONENT_CATALOG", {
240
+ enumerable: true,
241
+ get: function () { return chunkIJKWKY4H_cjs.COMPONENT_CATALOG; }
242
+ });
243
+ Object.defineProperty(exports, "DEFAULT_TRUST_HREF", {
244
+ enumerable: true,
245
+ get: function () { return chunkIJKWKY4H_cjs.DEFAULT_TRUST_HREF; }
246
+ });
247
+ Object.defineProperty(exports, "DisputeBanner", {
248
+ enumerable: true,
249
+ get: function () { return chunkIJKWKY4H_cjs.DisputeBanner; }
250
+ });
251
+ Object.defineProperty(exports, "EN_COMPONENT_STRINGS", {
252
+ enumerable: true,
253
+ get: function () { return chunkIJKWKY4H_cjs.EN_COMPONENT_STRINGS; }
254
+ });
255
+ Object.defineProperty(exports, "GuaranteedBadge", {
256
+ enumerable: true,
257
+ get: function () { return chunkIJKWKY4H_cjs.GuaranteedBadge; }
258
+ });
259
+ Object.defineProperty(exports, "HireButton", {
260
+ enumerable: true,
261
+ get: function () { return chunkIJKWKY4H_cjs.HireButton; }
262
+ });
263
+ Object.defineProperty(exports, "HireCheckoutModal", {
264
+ enumerable: true,
265
+ get: function () { return chunkIJKWKY4H_cjs.HireCheckoutModal; }
266
+ });
267
+ Object.defineProperty(exports, "ListingCard", {
268
+ enumerable: true,
269
+ get: function () { return chunkIJKWKY4H_cjs.ListingCard; }
270
+ });
271
+ Object.defineProperty(exports, "ListingGrid", {
272
+ enumerable: true,
273
+ get: function () { return chunkIJKWKY4H_cjs.ListingGrid; }
274
+ });
275
+ Object.defineProperty(exports, "Modal", {
276
+ enumerable: true,
277
+ get: function () { return chunkIJKWKY4H_cjs.Modal; }
278
+ });
279
+ Object.defineProperty(exports, "ModerationBadge", {
280
+ enumerable: true,
281
+ get: function () { return chunkIJKWKY4H_cjs.ModerationBadge; }
282
+ });
283
+ Object.defineProperty(exports, "PoweredByAgenC", {
284
+ enumerable: true,
285
+ get: function () { return chunkIJKWKY4H_cjs.PoweredByAgenC; }
286
+ });
287
+ Object.defineProperty(exports, "ProviderCard", {
288
+ enumerable: true,
289
+ get: function () { return chunkIJKWKY4H_cjs.ProviderCard; }
290
+ });
291
+ Object.defineProperty(exports, "ReferrerDisclosure", {
292
+ enumerable: true,
293
+ get: function () { return chunkIJKWKY4H_cjs.ReferrerDisclosure; }
294
+ });
295
+ Object.defineProperty(exports, "ReviewPanel", {
296
+ enumerable: true,
297
+ get: function () { return chunkIJKWKY4H_cjs.ReviewPanel; }
298
+ });
299
+ Object.defineProperty(exports, "Spinner", {
300
+ enumerable: true,
301
+ get: function () { return chunkIJKWKY4H_cjs.Spinner; }
302
+ });
303
+ Object.defineProperty(exports, "StateMessage", {
304
+ enumerable: true,
305
+ get: function () { return chunkIJKWKY4H_cjs.StateMessage; }
306
+ });
307
+ Object.defineProperty(exports, "TaskTimeline", {
308
+ enumerable: true,
309
+ get: function () { return chunkIJKWKY4H_cjs.TaskTimeline; }
310
+ });
311
+ Object.defineProperty(exports, "UNVERIFIED", {
312
+ enumerable: true,
313
+ get: function () { return chunkIJKWKY4H_cjs.UNVERIFIED; }
314
+ });
315
+ Object.defineProperty(exports, "VerifiedBadge", {
316
+ enumerable: true,
317
+ get: function () { return chunkIJKWKY4H_cjs.VerifiedBadge; }
318
+ });
319
+ Object.defineProperty(exports, "agencThemeStyleTag", {
320
+ enumerable: true,
321
+ get: function () { return chunkIJKWKY4H_cjs.agencThemeStyleTag; }
322
+ });
323
+ Object.defineProperty(exports, "agentVerificationReaderFromRpc", {
324
+ enumerable: true,
325
+ get: function () { return chunkIJKWKY4H_cjs.agentVerificationReaderFromRpc; }
326
+ });
327
+ Object.defineProperty(exports, "cx", {
328
+ enumerable: true,
329
+ get: function () { return chunkIJKWKY4H_cjs.cx; }
330
+ });
331
+ Object.defineProperty(exports, "decodeListingCategory", {
332
+ enumerable: true,
333
+ get: function () { return chunkIJKWKY4H_cjs.decodeListingCategory; }
334
+ });
335
+ Object.defineProperty(exports, "decodeListingName", {
336
+ enumerable: true,
337
+ get: function () { return chunkIJKWKY4H_cjs.decodeListingName; }
338
+ });
339
+ Object.defineProperty(exports, "decodeListingTags", {
340
+ enumerable: true,
341
+ get: function () { return chunkIJKWKY4H_cjs.decodeListingTags; }
342
+ });
343
+ Object.defineProperty(exports, "elementClass", {
344
+ enumerable: true,
345
+ get: function () { return chunkIJKWKY4H_cjs.elementClass; }
346
+ });
347
+ Object.defineProperty(exports, "evaluateAgentVerification", {
348
+ enumerable: true,
349
+ get: function () { return chunkIJKWKY4H_cjs.evaluateAgentVerification; }
350
+ });
351
+ Object.defineProperty(exports, "formatPriceSol", {
352
+ enumerable: true,
353
+ get: function () { return chunkIJKWKY4H_cjs.formatPriceSol; }
354
+ });
355
+ Object.defineProperty(exports, "formatRate", {
356
+ enumerable: true,
357
+ get: function () { return chunkIJKWKY4H_cjs.formatRate; }
358
+ });
359
+ Object.defineProperty(exports, "formatSol", {
360
+ enumerable: true,
361
+ get: function () { return chunkIJKWKY4H_cjs.formatSol; }
362
+ });
363
+ Object.defineProperty(exports, "moderationStateOf", {
364
+ enumerable: true,
365
+ get: function () { return chunkIJKWKY4H_cjs.moderationStateOf; }
366
+ });
367
+ Object.defineProperty(exports, "resolveThemeClassName", {
368
+ enumerable: true,
369
+ get: function () { return chunkIJKWKY4H_cjs.resolveThemeClassName; }
370
+ });
371
+ Object.defineProperty(exports, "rootClass", {
372
+ enumerable: true,
373
+ get: function () { return chunkIJKWKY4H_cjs.rootClass; }
374
+ });
375
+ Object.defineProperty(exports, "tc", {
376
+ enumerable: true,
377
+ get: function () { return chunkIJKWKY4H_cjs.tc; }
378
+ });
379
+ Object.defineProperty(exports, "toHex", {
380
+ enumerable: true,
381
+ get: function () { return chunkIJKWKY4H_cjs.toHex; }
382
+ });
383
+ Object.defineProperty(exports, "truncateAddress", {
384
+ enumerable: true,
385
+ get: function () { return chunkIJKWKY4H_cjs.truncateAddress; }
386
+ });
387
+ Object.defineProperty(exports, "useAgentVerification", {
388
+ enumerable: true,
389
+ get: function () { return chunkIJKWKY4H_cjs.useAgentVerification; }
390
+ });
391
+ Object.defineProperty(exports, "useFocusTrap", {
392
+ enumerable: true,
393
+ get: function () { return chunkIJKWKY4H_cjs.useFocusTrap; }
394
+ });
395
+ Object.defineProperty(exports, "AgencContext", {
396
+ enumerable: true,
397
+ get: function () { return chunkJTSG5FGC_cjs.AgencContext; }
398
+ });
399
+ Object.defineProperty(exports, "useAgencContext", {
400
+ enumerable: true,
401
+ get: function () { return chunkJTSG5FGC_cjs.useAgencContext; }
402
+ });
403
+ Object.defineProperty(exports, "EN_STRINGS", {
404
+ enumerable: true,
405
+ get: function () { return chunkFIDFPM5A_cjs.EN_STRINGS; }
406
+ });
407
+ Object.defineProperty(exports, "t", {
408
+ enumerable: true,
409
+ get: function () { return chunkFIDFPM5A_cjs.t; }
1698
410
  });
1699
- function evaluateAgentVerification(account, nowSeconds) {
1700
- if (!account) return UNVERIFIED;
1701
- if (account.revoked) return UNVERIFIED;
1702
- if (account.expiresAt !== 0n && nowSeconds >= account.expiresAt) {
1703
- return UNVERIFIED;
1704
- }
1705
- return {
1706
- verified: true,
1707
- domain: account.verifiedDomain,
1708
- method: account.method,
1709
- verifiedBy: account.verifiedBy,
1710
- verifiedAt: account.verifiedAt,
1711
- expiresAt: account.expiresAt,
1712
- revoked: false
1713
- };
1714
- }
1715
- function defaultNow() {
1716
- return BigInt(Math.floor(Date.now() / 1e3));
1717
- }
1718
- function agentVerificationReaderFromRpc(rpc, options) {
1719
- const now = options?.now ?? defaultNow;
1720
- return async (agentPda) => {
1721
- const [pda] = await marketplaceSdk.findAgentVerificationPda({ agent: agentPda });
1722
- const maybe = await marketplaceSdk.fetchMaybeAgentVerification(rpc, pda);
1723
- return evaluateAgentVerification(maybe.exists ? maybe.data : null, now());
1724
- };
1725
- }
1726
- function useAgentVerification(agentPda, options) {
1727
- const reader = options?.reader;
1728
- const enabled = (options?.enabled ?? true) && Boolean(agentPda) && Boolean(reader);
1729
- const query = reactQuery.useQuery({
1730
- queryKey: ["agenc", "agentVerification", agentPda ? String(agentPda) : ""],
1731
- enabled,
1732
- queryFn: async () => {
1733
- return reader(agentPda);
1734
- }
1735
- });
1736
- const verification = query.error ? UNVERIFIED : query.data ?? UNVERIFIED;
1737
- return {
1738
- verification,
1739
- verified: verification.verified,
1740
- isLoading: query.isLoading && enabled,
1741
- error: query.error ?? null,
1742
- refetch: () => void query.refetch()
1743
- };
1744
- }
1745
- function VerifiedDomainBadge({
1746
- domain,
1747
- unstyled
1748
- }) {
1749
- return /* @__PURE__ */ jsxRuntime.jsx(
1750
- Badge,
1751
- {
1752
- tone: "success",
1753
- unstyled,
1754
- className: unstyled ? void 0 : "agenc-provider__domain agenc-provider__domain--verified",
1755
- label: tc("components.provider.verifiedDomainLabel", { domain }),
1756
- children: tc("components.provider.verifiedDomain", { domain })
1757
- }
1758
- );
1759
- }
1760
- function ClaimedDomainBadge({
1761
- domain,
1762
- unstyled
1763
- }) {
1764
- return /* @__PURE__ */ jsxRuntime.jsx(
1765
- Badge,
1766
- {
1767
- tone: "neutral",
1768
- unstyled,
1769
- className: unstyled ? void 0 : "agenc-provider__domain agenc-provider__domain--claimed",
1770
- label: tc("components.provider.claimedDomainLabel", { domain }),
1771
- children: tc("components.provider.claimedDomain", { domain })
1772
- }
1773
- );
1774
- }
1775
- function ProviderCard({
1776
- agent,
1777
- trackRecord,
1778
- verification = UNVERIFIED,
1779
- operatorDomain,
1780
- verified = false,
1781
- isLoading = false,
1782
- error = null,
1783
- onRetry,
1784
- unstyled,
1785
- className
1786
- }) {
1787
- const cardClass = rootClass("agenc-provider", unstyled, className);
1788
- const isVerified = verification.verified || verification === UNVERIFIED && verified;
1789
- const verifiedDomain = verification.verified ? verification.domain : null;
1790
- const claimed = typeof operatorDomain === "string" && operatorDomain.trim() !== "" ? operatorDomain.trim() : null;
1791
- const domainBadge = verifiedDomain ? /* @__PURE__ */ jsxRuntime.jsx(VerifiedDomainBadge, { domain: verifiedDomain, unstyled }) : claimed ? /* @__PURE__ */ jsxRuntime.jsx(ClaimedDomainBadge, { domain: claimed, unstyled }) : null;
1792
- const header = /* @__PURE__ */ jsxRuntime.jsxs("header", { className: unstyled ? void 0 : "agenc-provider__header", children: [
1793
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-provider__id", children: [
1794
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-provider__label", children: tc("components.provider.title") }),
1795
- agent ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-provider__pda", children: truncateAddress(agent) }) : null
1796
- ] }),
1797
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-provider__badges", children: [
1798
- domainBadge,
1799
- /* @__PURE__ */ jsxRuntime.jsx(VerifiedBadge, { verified: isVerified, unstyled })
1800
- ] })
1801
- ] });
1802
- if (error) {
1803
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: cardClass, "aria-label": tc("components.provider.title"), children: [
1804
- header,
1805
- /* @__PURE__ */ jsxRuntime.jsx(
1806
- StateMessage,
1807
- {
1808
- kind: "error",
1809
- message: tc("components.provider.unavailable"),
1810
- onRetry,
1811
- unstyled
1812
- }
1813
- )
1814
- ] });
1815
- }
1816
- if (isLoading && trackRecord === null) {
1817
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: cardClass, "aria-label": tc("components.provider.title"), children: [
1818
- header,
1819
- /* @__PURE__ */ jsxRuntime.jsx(StateMessage, { kind: "loading", unstyled })
1820
- ] });
1821
- }
1822
- if (trackRecord === null) {
1823
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: cardClass, "aria-label": tc("components.provider.title"), children: [
1824
- header,
1825
- /* @__PURE__ */ jsxRuntime.jsx(
1826
- StateMessage,
1827
- {
1828
- kind: "empty",
1829
- message: tc("components.provider.noData"),
1830
- unstyled
1831
- }
1832
- )
1833
- ] });
1834
- }
1835
- const provisional = trackRecord.partial;
1836
- return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: cardClass, "aria-label": tc("components.provider.title"), children: [
1837
- header,
1838
- /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: unstyled ? void 0 : "agenc-provider__stats", children: [
1839
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-provider__stat", children: [
1840
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: tc("components.provider.completionRate") }),
1841
- /* @__PURE__ */ jsxRuntime.jsxs("dd", { children: [
1842
- formatRate(trackRecord.completionRate),
1843
- provisional ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: unstyled ? void 0 : "agenc-provider__provisional", children: [
1844
- " ",
1845
- "(",
1846
- tc("components.provider.provisional"),
1847
- ")"
1848
- ] }) : null
1849
- ] })
1850
- ] }),
1851
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-provider__stat", children: [
1852
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: tc("components.provider.disputeRate") }),
1853
- /* @__PURE__ */ jsxRuntime.jsxs("dd", { children: [
1854
- formatRate(trackRecord.disputeRate),
1855
- provisional ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: unstyled ? void 0 : "agenc-provider__provisional", children: [
1856
- " ",
1857
- "(",
1858
- tc("components.provider.provisional"),
1859
- ")"
1860
- ] }) : null
1861
- ] })
1862
- ] }),
1863
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: unstyled ? void 0 : "agenc-provider__stat", children: [
1864
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: tc("components.provider.completions", {
1865
- count: String(trackRecord.completions)
1866
- }) }),
1867
- /* @__PURE__ */ jsxRuntime.jsx("dd", { children: tc("components.provider.disputes", {
1868
- count: String(trackRecord.disputesLost)
1869
- }) })
1870
- ] })
1871
- ] })
1872
- ] });
1873
- }
1874
- var DEFAULT_TRUST_HREF = "https://agenc.tech/trust";
1875
- var SAFE_HREF_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:", "mailto:"]);
1876
- function safeHref(href) {
1877
- try {
1878
- const url = new URL(href, DEFAULT_TRUST_HREF);
1879
- return SAFE_HREF_SCHEMES.has(url.protocol) ? href : DEFAULT_TRUST_HREF;
1880
- } catch {
1881
- return DEFAULT_TRUST_HREF;
1882
- }
1883
- }
1884
- function PoweredByAgenC({
1885
- href = DEFAULT_TRUST_HREF,
1886
- newTab = true,
1887
- label,
1888
- unstyled,
1889
- className
1890
- }) {
1891
- const linkClass = rootClass("agenc-powered-by", unstyled, className);
1892
- return /* @__PURE__ */ jsxRuntime.jsx(
1893
- "a",
1894
- {
1895
- className: linkClass,
1896
- href: safeHref(href),
1897
- target: newTab ? "_blank" : void 0,
1898
- rel: newTab ? "noopener noreferrer" : void 0,
1899
- "aria-label": `${label ?? tc("components.poweredBy.label")} \u2014 ${tc(
1900
- "components.poweredBy.trustLink"
1901
- )}`,
1902
- children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: unstyled ? void 0 : "agenc-powered-by__label", children: label ?? tc("components.poweredBy.label") })
1903
- }
1904
- );
1905
- }
1906
-
1907
- exports.AGENC_THEME_CLASS = AGENC_THEME_CLASS;
1908
- exports.AGENC_TOKENS_CSS_PATH = AGENC_TOKENS_CSS_PATH;
1909
- exports.AgencContext = AgencContext;
1910
411
  exports.AgencProvider = AgencProvider;
1911
- exports.Badge = Badge;
1912
- exports.Button = Button;
1913
- exports.COMPONENT_CATALOG = COMPONENT_CATALOG;
1914
- exports.DEFAULT_TRUST_HREF = DEFAULT_TRUST_HREF;
1915
- exports.DisputeBanner = DisputeBanner;
1916
- exports.EN_COMPONENT_STRINGS = EN_COMPONENT_STRINGS;
1917
- exports.EN_SIGNER_STRINGS = EN_SIGNER_STRINGS;
1918
- exports.EN_STRINGS = EN_STRINGS;
1919
- exports.GuaranteedBadge = GuaranteedBadge;
1920
- exports.HireButton = HireButton;
1921
- exports.HireCheckoutModal = HireCheckoutModal;
1922
- exports.ListingCard = ListingCard;
1923
- exports.ListingGrid = ListingGrid;
1924
- exports.Modal = Modal;
1925
- exports.ModerationBadge = ModerationBadge;
1926
- exports.PoweredByAgenC = PoweredByAgenC;
1927
- exports.ProviderCard = ProviderCard;
1928
412
  exports.REFERRER_FEE_BPS_MAX = REFERRER_FEE_BPS_MAX;
1929
413
  exports.REFERRER_FEE_BPS_MIN = REFERRER_FEE_BPS_MIN;
1930
- exports.ReadTransportUnsupportedError = ReadTransportUnsupportedError;
1931
- exports.ReferrerDisclosure = ReferrerDisclosure;
1932
- exports.ReviewPanel = ReviewPanel;
1933
- exports.Spinner = Spinner;
1934
- exports.StateMessage = StateMessage;
1935
- exports.TaskTimeline = TaskTimeline;
1936
- exports.UNVERIFIED = UNVERIFIED;
1937
- exports.VerifiedBadge = VerifiedBadge;
1938
- exports.agencThemeStyleTag = agencThemeStyleTag;
1939
- exports.agentVerificationReaderFromRpc = agentVerificationReaderFromRpc;
1940
- exports.createReadTransport = createReadTransport;
1941
- exports.cx = cx;
1942
- exports.decodeListingCategory = decodeListingCategory;
1943
- exports.decodeListingName = decodeListingName;
1944
- exports.decodeListingTags = decodeListingTags;
1945
414
  exports.deriveSubscriptionsUrl = deriveSubscriptionsUrl;
1946
- exports.elementClass = elementClass;
1947
- exports.evaluateAgentVerification = evaluateAgentVerification;
1948
- exports.formatPriceSol = formatPriceSol;
1949
- exports.formatRate = formatRate;
1950
- exports.formatSol = formatSol;
1951
- exports.moderationStateOf = moderationStateOf;
1952
415
  exports.resolveEndpoints = resolveEndpoints;
1953
416
  exports.resolveReferrerCapability = resolveReferrerCapability;
1954
- exports.resolveThemeClassName = resolveThemeClassName;
1955
- exports.rootClass = rootClass;
1956
- exports.signerFromEmbeddedWallet = signerFromEmbeddedWallet;
1957
- exports.signerFromWalletAccount = signerFromWalletAccount;
1958
- exports.signerFromWalletAdapter = signerFromWalletAdapter;
1959
- exports.t = t;
1960
- exports.tc = tc;
1961
- exports.toHex = toHex;
1962
- exports.truncateAddress = truncateAddress;
1963
- exports.useAgencContext = useAgencContext;
1964
- exports.useAgentVerification = useAgentVerification;
1965
- exports.useFocusTrap = useFocusTrap;
1966
417
  exports.validateReferrerConfig = validateReferrerConfig;
1967
418
  //# sourceMappingURL=index.cjs.map
1968
419
  //# sourceMappingURL=index.cjs.map