@coinlist-co/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 (61) hide show
  1. package/dist/chunk-CRACFEJ4.js +17 -0
  2. package/dist/chunk-CRACFEJ4.js.map +1 -0
  3. package/dist/{chunk-NC45IO63.js → chunk-N3WBC2VS.js} +20 -325
  4. package/dist/chunk-N3WBC2VS.js.map +1 -0
  5. package/dist/chunk-V6WO67RO.js +311 -0
  6. package/dist/chunk-V6WO67RO.js.map +1 -0
  7. package/dist/client/index.cjs +1013 -220
  8. package/dist/client/index.cjs.map +1 -1
  9. package/dist/client/index.d.cts +526 -9
  10. package/dist/client/index.d.ts +526 -9
  11. package/dist/client/index.js +1464 -94
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/{participation-DMMEDxON.d.cts → requirement-BEO42QOr.d.cts} +204 -2
  14. package/dist/{participation-E-bT-GXJ.d.ts → requirement-BEO42QOr.d.ts} +204 -2
  15. package/dist/server/index.cjs +9 -91
  16. package/dist/server/index.cjs.map +1 -1
  17. package/dist/server/index.d.cts +4 -21
  18. package/dist/server/index.d.ts +4 -21
  19. package/dist/server/index.js +14 -78
  20. package/dist/server/index.js.map +1 -1
  21. package/dist/shared/index.cjs +375 -0
  22. package/dist/shared/index.cjs.map +1 -0
  23. package/dist/shared/index.d.cts +35 -0
  24. package/dist/shared/index.d.ts +35 -0
  25. package/dist/{client/core → shared}/index.js +35 -16
  26. package/dist/shared/index.js.map +1 -0
  27. package/package.json +7 -22
  28. package/dist/RequirementItem-B-MvcxSr.d.cts +0 -37
  29. package/dist/RequirementItem-DcYot2uC.d.ts +0 -37
  30. package/dist/chunk-EHZ6PIGN.js +0 -414
  31. package/dist/chunk-EHZ6PIGN.js.map +0 -1
  32. package/dist/chunk-NC45IO63.js.map +0 -1
  33. package/dist/chunk-RIFATQB5.js +0 -257
  34. package/dist/chunk-RIFATQB5.js.map +0 -1
  35. package/dist/chunk-UGJUTRXC.js +0 -304
  36. package/dist/chunk-UGJUTRXC.js.map +0 -1
  37. package/dist/chunk-YJQMJFA7.js +0 -16
  38. package/dist/chunk-YJQMJFA7.js.map +0 -1
  39. package/dist/client/components/index.cjs +0 -1108
  40. package/dist/client/components/index.cjs.map +0 -1
  41. package/dist/client/components/index.d.cts +0 -139
  42. package/dist/client/components/index.d.ts +0 -139
  43. package/dist/client/components/index.js +0 -558
  44. package/dist/client/components/index.js.map +0 -1
  45. package/dist/client/core/index.cjs +0 -1047
  46. package/dist/client/core/index.cjs.map +0 -1
  47. package/dist/client/core/index.d.cts +0 -23
  48. package/dist/client/core/index.d.ts +0 -23
  49. package/dist/client/core/index.js.map +0 -1
  50. package/dist/client/hooks/index.cjs +0 -307
  51. package/dist/client/hooks/index.cjs.map +0 -1
  52. package/dist/client/hooks/index.d.cts +0 -126
  53. package/dist/client/hooks/index.d.ts +0 -126
  54. package/dist/client/hooks/index.js +0 -19
  55. package/dist/client/hooks/index.js.map +0 -1
  56. package/dist/coinlist-client-BSxpqylo.d.ts +0 -158
  57. package/dist/coinlist-client-Cah5c_aF.d.cts +0 -158
  58. package/dist/requirement-XWT0T_zO.d.cts +0 -205
  59. package/dist/requirement-XWT0T_zO.d.ts +0 -205
  60. package/dist/useCoinListRequirements-B5-ZPOMz.d.ts +0 -80
  61. package/dist/useCoinListRequirements-Cuc32Tqw.d.cts +0 -80
@@ -0,0 +1,17 @@
1
+ // src/shared/types/oauth.ts
2
+ var AuthorizationCode = (value) => value;
3
+ var CodeVerifier = (value) => value;
4
+ var CodeChallenge = (value) => value;
5
+ var RedirectUri = (value) => value;
6
+ var ClientId = (value) => value;
7
+ var ClientSecret = (value) => value;
8
+
9
+ export {
10
+ AuthorizationCode,
11
+ CodeVerifier,
12
+ CodeChallenge,
13
+ RedirectUri,
14
+ ClientId,
15
+ ClientSecret
16
+ };
17
+ //# sourceMappingURL=chunk-CRACFEJ4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shared/types/oauth.ts"],"sourcesContent":["import type { Newtype } from '@/shared/types/newtype';\n\nexport type AuthorizationCode = Newtype<string, 'AuthorizationCode'>;\nexport const AuthorizationCode = (value: string): AuthorizationCode =>\n value as AuthorizationCode;\n\nexport type CodeVerifier = Newtype<string, 'CodeVerifier'>;\nexport const CodeVerifier = (value: string): CodeVerifier =>\n value as CodeVerifier;\n\nexport type CodeChallenge = Newtype<string, 'CodeChallenge'>;\nexport const CodeChallenge = (value: string): CodeChallenge =>\n value as CodeChallenge;\n\nexport type RedirectUri = Newtype<string, 'RedirectUri'>;\nexport const RedirectUri = (value: string): RedirectUri => value as RedirectUri;\n\nexport type ClientId = Newtype<string, 'ClientId'>;\nexport const ClientId = (value: string): ClientId => value as ClientId;\n\nexport type ClientSecret = Newtype<string, 'ClientSecret'>;\nexport const ClientSecret = (value: string): ClientSecret =>\n value as ClientSecret;\n"],"mappings":";AAGO,IAAM,oBAAoB,CAAC,UAChC;AAGK,IAAM,eAAe,CAAC,UAC3B;AAGK,IAAM,gBAAgB,CAAC,UAC5B;AAGK,IAAM,cAAc,CAAC,UAA+B;AAGpD,IAAM,WAAW,CAAC,UAA4B;AAG9C,IAAM,eAAe,CAAC,UAC3B;","names":[]}
@@ -1,287 +1,18 @@
1
- // src/shared/api/pagination.ts
2
- var Cursor = (value) => value;
3
- async function fetchAllPages(fetchPage, baseParams) {
4
- const items = [];
5
- let cursor = null;
6
- do {
7
- const params = {
8
- ...baseParams ?? {},
9
- after: cursor ?? void 0
10
- };
11
- const page = await fetchPage(params);
12
- items.push(...page.data);
13
- cursor = page.startingAfter;
14
- } while (cursor);
15
- return items;
16
- }
17
- var PaginatedResponse = {
18
- fromDto: (dto, itemMapper) => ({
19
- data: dto.data.map(itemMapper),
20
- startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,
21
- startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null
22
- })
23
- };
24
- var PaginationParams = {
25
- toQueryParams: (params) => {
26
- const queryParams = {};
27
- if (params.after) {
28
- queryParams.starting_after = params.after;
29
- }
30
- if (params.before) {
31
- queryParams.starting_before = params.before;
32
- }
33
- if (params.limit) {
34
- queryParams.limit = params.limit;
35
- }
36
- return queryParams;
37
- }
38
- };
39
-
40
- // src/shared/utils.ts
41
- async function sha256(data) {
42
- const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
43
- const buffer = bytes.buffer.slice(
44
- bytes.byteOffset,
45
- bytes.byteOffset + bytes.byteLength
46
- );
47
- return crypto.subtle.digest("SHA-256", buffer);
48
- }
49
- function arrayBufferToBase64Url(buffer, padding = true) {
50
- const bytes = new Uint8Array(buffer);
51
- let binary = "";
52
- for (let i = 0; i < bytes.length; i++) {
53
- binary += String.fromCharCode(bytes[i]);
54
- }
55
- let base64 = btoa(binary);
56
- base64 = base64.replace(/\+/g, "-").replace(/\//g, "_");
57
- if (!padding) {
58
- base64 = base64.replace(/=+$/, "");
59
- }
60
- return base64;
61
- }
62
- function generateSecureRandomBase64Url(byteLength) {
63
- const bytes = new Uint8Array(byteLength);
64
- crypto.getRandomValues(bytes);
65
- const buffer = bytes.buffer;
66
- return arrayBufferToBase64Url(buffer, false);
67
- }
68
- function getUUIDv4() {
69
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
70
- return crypto.randomUUID();
71
- }
72
- if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
73
- const bytes = new Uint8Array(16);
74
- crypto.getRandomValues(bytes);
75
- bytes[6] = bytes[6] & 15 | 64;
76
- bytes[8] = bytes[8] & 63 | 128;
77
- const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0"));
78
- return `${hex.slice(0, 4).join("")}-${hex.slice(4, 6).join("")}-${hex.slice(6, 8).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10, 16).join("")}`;
79
- }
80
- return `${Date.now()}-${Math.random().toString(36).slice(2, 12)}`;
81
- }
82
- function notBlankStringOrNull(value) {
83
- if (value?.trim()) {
84
- return value;
85
- } else {
86
- return null;
87
- }
88
- }
89
-
90
- // src/shared/types/offer.ts
91
- var OfferId = (value) => value;
92
- var OfferSlug = (value) => value;
93
- var Offer = {
94
- fromDto: (dto) => ({
95
- id: OfferId(dto.id),
96
- slug: OfferSlug(dto.slug),
97
- tagline: notBlankStringOrNull(dto.tagline),
98
- bannerUrl: notBlankStringOrNull(dto.banner_url),
99
- logoUrl: notBlankStringOrNull(dto.logo_url),
100
- startsAt: new Date(dto.starts_at),
101
- endsAt: new Date(dto.ends_at)
102
- })
103
- };
104
-
105
- // src/shared/types/asset.ts
106
- var AssetId = (value) => value;
107
- var AssetCode = (value) => value;
108
- var Asset = {
109
- fromDto: (dto) => ({
110
- id: AssetId(dto.id),
111
- code: AssetCode(dto.code),
112
- name: dto.name,
113
- fractionalDigits: dto.fractional_digits
114
- })
115
- };
116
-
117
- // src/shared/types/offer-detail.ts
118
- var OfferOptionId = (value) => value;
119
- var OfferOptionSlug = (value) => value;
120
- var OfferDetail = {
121
- fromDto: (dto) => {
122
- if (!Array.isArray(dto.funding_assets)) {
123
- throw new Error(`funding_assets must be an array`);
124
- }
125
- if (!Array.isArray(dto.options)) {
126
- throw new Error(`options must be an array`);
127
- }
128
- if (!Array.isArray(dto.terms)) {
129
- throw new Error(`terms must be an array`);
130
- }
131
- if (!Array.isArray(dto.links)) {
132
- throw new Error(`links must be an array`);
133
- }
134
- if (!Array.isArray(dto.faqs)) {
135
- throw new Error(`faqs must be an array`);
136
- }
137
- if (!Array.isArray(dto.milestones)) {
138
- throw new Error(`milestones must be an array`);
139
- }
140
- return {
141
- id: OfferId(dto.id),
142
- slug: OfferSlug(dto.slug),
143
- name: dto.name,
144
- asset: Asset.fromDto(dto.asset),
145
- fundingAssets: dto.funding_assets.map(Asset.fromDto),
146
- about: notBlankStringOrNull(dto.about),
147
- tagline: notBlankStringOrNull(dto.tagline),
148
- bannerUrl: notBlankStringOrNull(dto.banner_url),
149
- logoUrl: notBlankStringOrNull(dto.logo_url),
150
- category: notBlankStringOrNull(dto.category),
151
- startsAt: new Date(dto.starts_at),
152
- endsAt: new Date(dto.ends_at),
153
- faqs: dto.faqs.map(FaqItem.fromDto),
154
- links: dto.links.map(Link.fromDto),
155
- milestones: dto.milestones.map(Milestone.fromDto),
156
- options: dto.options.map(OfferOption.fromDto),
157
- terms: dto.terms.map(TermItem.fromDto)
158
- };
159
- }
160
- };
161
- var OfferOption = {
162
- fromDto: (dto) => ({
163
- id: OfferOptionId(dto.id),
164
- slug: OfferOptionSlug(dto.slug),
165
- bidIncrement: dto.bid_increment,
166
- floorPriceUsd: dto.floor_price_usd,
167
- minimumPurchaseUsd: dto.minimum_purchase_usd,
168
- priceUsd: dto.price_usd,
169
- saleAgreementUrl: notBlankStringOrNull(dto.sale_agreement_url),
170
- totalTokenSupply: dto.total_token_supply
171
- })
172
- };
173
- var FaqItem = {
174
- fromDto: (dto) => ({
175
- question: notBlankStringOrNull(dto.question),
176
- answer: notBlankStringOrNull(dto.answer)
177
- })
178
- };
179
- var Link = {
180
- fromDto: (dto) => ({
181
- label: notBlankStringOrNull(dto.label),
182
- url: notBlankStringOrNull(dto.url)
183
- })
184
- };
185
- var TermItem = {
186
- fromDto: (dto) => ({
187
- key: notBlankStringOrNull(dto.key),
188
- value: notBlankStringOrNull(dto.value)
189
- })
190
- };
191
- var Milestone = {
192
- fromDto: (dto) => ({
193
- name: notBlankStringOrNull(dto.name),
194
- schedule: notBlankStringOrNull(dto.schedule),
195
- status: dto.status
196
- })
197
- };
198
-
199
- // src/shared/types/participation.ts
200
- var ParticipationId = (value) => value;
201
- var Blockchain = (value) => value;
202
- var WalletAddress = (value) => value;
203
- var ParticipationsPaginationParams = {
204
- toQueryParams: (params) => {
205
- const queryParams = PaginationParams.toQueryParams(params);
206
- if (params.offerId) {
207
- queryParams["filters[0][field]"] = "offer_id";
208
- queryParams["filters[0][op]"] = "==";
209
- queryParams["filters[0][value]"] = params.offerId;
210
- }
211
- return queryParams;
212
- }
213
- };
214
- var Participation = {
215
- /** Maps API DTO shape into the SDK participation domain model. */
216
- fromDto: (dto) => {
217
- const walletAddress = notBlankStringOrNull(dto.wallet_address);
218
- return {
219
- id: ParticipationId(dto.id),
220
- offerId: OfferId(dto.offer_id),
221
- offerOptionId: OfferOptionId(dto.offer_option_id),
222
- status: dto.status,
223
- amount: dto.amount,
224
- displayAmount: dto.amount_string,
225
- asset: Asset.fromDto(dto.asset),
226
- chain: Blockchain(dto.chain),
227
- insertedAt: dto.inserted_at ? new Date(dto.inserted_at) : null,
228
- updatedAt: dto.updated_at ? new Date(dto.updated_at) : null,
229
- walletAddress: walletAddress ? WalletAddress(walletAddress) : null
230
- };
231
- }
232
- };
233
- var CreateParticipationParams = {
234
- /** Maps participation creation params into API DTO payload. */
235
- toDto: (params) => ({
236
- offer_id: params.offerId,
237
- offer_option_id: params.offerOptionId,
238
- chain: params.chain,
239
- wallet_address: params.walletAddress,
240
- amount: params.amount,
241
- asset_id: params.assetId,
242
- approval_transaction_hash: params.approvalTransactionHash
243
- })
244
- };
245
-
246
- // src/shared/types/requirement.ts
247
- var RequirementId = (value) => value;
248
- var Requirement = {
249
- fromDto: (dto) => ({
250
- id: RequirementId(dto.id),
251
- type: dto.type,
252
- details: dto.details
253
- })
254
- };
255
- var RequirementStatusInfo = {
256
- fromStatusesDto: (dto) => Object.entries(dto.statuses).map(([id, status]) => ({
257
- id: RequirementId(id),
258
- status
259
- }))
260
- };
261
-
262
- // src/shared/types/errors.ts
263
- var NotImplementedError = class extends Error {
264
- constructor(message = "Not implemented yet") {
265
- super(message);
266
- this.name = "NotImplementedError";
267
- }
268
- };
269
- var NotAuthenticatedError = class extends Error {
270
- constructor(message = "The user is not authenticated. Go through the OAuth flow first!") {
271
- super(message);
272
- this.name = "NotAuthenticatedError";
273
- }
274
- };
275
-
276
- // src/shared/types/oauth.ts
277
- var AuthorizationCode = (value) => value;
278
- var CodeVerifier = (value) => value;
279
- var CodeChallenge = (value) => value;
280
- var RedirectUri = (value) => value;
281
- var ClientId = (value) => value;
282
- var ClientSecret = (value) => value;
1
+ import {
2
+ CreateParticipationParams,
3
+ Offer,
4
+ OfferDetail,
5
+ PaginatedResponse,
6
+ PaginationParams,
7
+ Participation,
8
+ ParticipationsPaginationParams,
9
+ Requirement,
10
+ RequirementStatusInfo,
11
+ fetchAllPages,
12
+ getUUIDv4
13
+ } from "./chunk-V6WO67RO.js";
283
14
 
284
- // src/shared/api/frontline/index.ts
15
+ // src/shared/api/frontline/config.ts
285
16
  var PUBLIC_API_BASE_URL = "https://api.coinlist.co";
286
17
  var HEADER_API_VERSION = "X-API-Version";
287
18
  var HEADER_USER_AGENT = "User-Agent";
@@ -441,7 +172,7 @@ var Request = {
441
172
  };
442
173
 
443
174
  // src/shared/api/frontline/offers.ts
444
- async function fetchAllOffers(api) {
175
+ async function fetchOffers(api) {
445
176
  return fetchAllPages((params) => fetchOffersPage(api, params));
446
177
  }
447
178
  async function fetchOffersPage(api, params) {
@@ -464,7 +195,7 @@ async function fetchOfferDetails(api, id) {
464
195
  }
465
196
 
466
197
  // src/shared/api/frontline/participations.ts
467
- async function fetchAllParticipations(api, offerId) {
198
+ async function fetchParticipations(api, offerId) {
468
199
  return fetchAllPages(
469
200
  (params) => fetchParticipationsPage(api, params),
470
201
  { offerId }
@@ -713,10 +444,6 @@ var AuthenticatedApiClient = class {
713
444
  };
714
445
 
715
446
  export {
716
- sha256,
717
- arrayBufferToBase64Url,
718
- generateSecureRandomBase64Url,
719
- getUUIDv4,
720
447
  PUBLIC_API_BASE_URL,
721
448
  HEADER_USER_AGENT,
722
449
  API_VERSION,
@@ -732,46 +459,14 @@ export {
732
459
  Attributes,
733
460
  HttpError,
734
461
  AuthenticatedApiClient,
735
- Cursor,
736
- fetchAllPages,
737
- PaginatedResponse,
738
- PaginationParams,
739
- OfferId,
740
- OfferSlug,
741
- Offer,
742
- OfferOptionId,
743
- OfferOptionSlug,
744
- OfferDetail,
745
- OfferOption,
746
- FaqItem,
747
- Link,
748
- TermItem,
749
- Milestone,
750
- fetchAllOffers,
462
+ fetchOffers,
751
463
  fetchOffersPage,
752
464
  fetchOfferDetails,
753
- ParticipationId,
754
- Blockchain,
755
- WalletAddress,
756
- ParticipationsPaginationParams,
757
- Participation,
758
- CreateParticipationParams,
759
- fetchAllParticipations,
465
+ fetchParticipations,
760
466
  fetchParticipationsPage,
761
467
  fetchParticipation,
762
468
  createParticipation,
763
- RequirementId,
764
- Requirement,
765
- RequirementStatusInfo,
766
469
  fetchOfferRequirements,
767
- fetchRequirementStatuses,
768
- NotImplementedError,
769
- NotAuthenticatedError,
770
- AuthorizationCode,
771
- CodeVerifier,
772
- CodeChallenge,
773
- RedirectUri,
774
- ClientId,
775
- ClientSecret
470
+ fetchRequirementStatuses
776
471
  };
777
- //# sourceMappingURL=chunk-NC45IO63.js.map
472
+ //# sourceMappingURL=chunk-N3WBC2VS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shared/api/frontline/config.ts","../src/shared/api/http-attributes.ts","../src/shared/api/http.ts","../src/shared/api/frontline/offers.ts","../src/shared/api/frontline/participations.ts","../src/shared/api/frontline/requirements.ts","../src/shared/api/http-client.ts","../src/shared/api/middleware/attach-session-middleware.ts","../src/shared/api/middleware/idempotency-key.ts","../src/shared/api/middleware/request-retry.ts","../src/shared/api/middleware/session-renewal.ts","../src/shared/api/authenticated-api-client.ts"],"sourcesContent":["export const PUBLIC_API_BASE_URL = 'https://api.coinlist.co';\nexport const HEADER_API_VERSION = 'X-API-Version';\nexport const HEADER_USER_AGENT = 'User-Agent';\nexport const HEADER_IDEMPOTENCY_KEY = 'Idempotency-Key';\nexport const API_VERSION = '2025-10-17';\n\nexport const COINLIST_BASE_URL = 'https://coinlist.co';\nexport const OAUTH_PAGE_PATH = '/oauth/authorize';\n\nexport const SUPPORT_NEW_TICKET_URL =\n 'https://support.coinlist.co/support/tickets/new';\n\nexport const VERIFY_IDENTITY_PATH = '/verify-identity';\nexport const VERIFY_IDENTITY_VERIFIED_PATH =\n '/verify-identity/identity_verified';\nexport const VERIFY_IDENTITY_PROOF_OF_ADDRESS_PATH =\n '/verify-identity/proof_of_address';\nexport const VERIFY_IDENTITY_SOURCE_OF_FUNDS_PATH =\n '/verify-identity/source_of_funds';\nexport const VERIFY_IDENTITY_ACCREDITATION_PATH =\n '/verify-identity/accreditation_full';\nexport const WALLET_PATH = '/wallet';\n","export type HttpRequestAttributes = {\n protected?: boolean;\n userAgent?: boolean;\n idempotencyKey?: boolean;\n /** Zero-based attempt index: 0 = first request, 1 = first retry, etc. */\n retryAttempt?: number;\n renewAttempted?: boolean;\n};\n\nexport type Attributes = Readonly<HttpRequestAttributes>;\n\nconst empty: Attributes = {};\n\nconst concat = (left: Attributes, right: Attributes): Attributes => ({\n ...left,\n ...right,\n});\n\nconst concatAll = (...items: Attributes[]): Attributes => {\n let result = empty;\n for (const item of items) {\n result = concat(result, item);\n }\n return result;\n};\n\nconst protectedRequest = (): Attributes => ({ protected: true });\nconst userAgent = (): Attributes => ({ userAgent: true });\nconst idempotencyKey = (): Attributes => ({\n idempotencyKey: true,\n});\n\n/** Returns attributes with the given retry attempt (zero-based). */\nconst retryAttempt = (attempt: number): Attributes => ({\n retryAttempt: attempt,\n});\nconst renewAttempted = (value: boolean): Attributes => ({\n renewAttempted: value,\n});\n\nconst isProtected = (attrs?: HttpRequestAttributes): boolean =>\n attrs?.protected === true;\nconst needUserAgent = (attrs?: HttpRequestAttributes): boolean =>\n attrs?.userAgent === true;\nconst isIdempotent = (attrs?: HttpRequestAttributes): boolean =>\n attrs?.idempotencyKey === true;\nconst getRetryAttempt = (attrs?: HttpRequestAttributes): number =>\n attrs?.retryAttempt ?? 0;\nconst wasRenewAttempted = (attrs?: HttpRequestAttributes): boolean =>\n attrs?.renewAttempted === true;\n\nexport const Attributes = {\n empty,\n concat,\n concatAll,\n protected: protectedRequest,\n isProtected,\n userAgent,\n needUserAgent,\n idempotencyKey,\n isIdempotent,\n retryAttempt,\n getRetryAttempt,\n renewAttempted,\n wasRenewAttempted,\n} as const;\n","import {\n Attributes,\n type HttpRequestAttributes,\n} from '@/shared/api/http-attributes';\n\nexport type HttpClientConfig = {\n baseUrl: string;\n xApiVersion: string;\n};\n\nexport type QueryParamValue = string | number | boolean | null | undefined;\nexport type QueryParamValues = QueryParamValue | QueryParamValue[];\n\nexport type HttpRequest<TBody = unknown> =\n | {\n method: 'GET';\n url: string;\n queryParams?: Record<string, QueryParamValues>;\n headers?: Record<string, string>;\n attributes?: HttpRequestAttributes;\n redirect?: RequestRedirect;\n }\n | {\n method: 'POST';\n url: string;\n queryParams?: Record<string, QueryParamValues>;\n headers?: Record<string, string>;\n body: TBody;\n attributes?: HttpRequestAttributes;\n redirect?: RequestRedirect;\n };\nexport type HttpResponse<TBody = unknown> = {\n status: number;\n headers?: Record<string, string>;\n body: TBody | null;\n};\n\nexport class HttpError<TBody = unknown> extends Error {\n readonly response: HttpResponse<TBody>;\n\n constructor(response: HttpResponse<TBody>) {\n super(`Request failed with ${response.status} status`);\n this.name = 'HttpError';\n this.response = response;\n }\n}\n\nexport async function makeRequest<TResponse = unknown>(\n request: HttpRequest\n): Promise<HttpResponse<TResponse>> {\n const headers: Record<string, string> = {\n Accept: 'application/json',\n ...(request.method === 'POST' && request.body !== undefined\n ? { 'Content-Type': 'application/json' }\n : {}),\n ...(request.headers ?? {}),\n };\n\n const init: RequestInit = {\n method: request.method,\n headers,\n ...(request.redirect !== undefined ? { redirect: request.redirect } : {}),\n };\n\n if (request.method === 'POST' && request.body !== undefined) {\n init.body = JSON.stringify(request.body);\n }\n\n const response = await fetch(\n buildUrlWithQueryParams(request.url, request.queryParams),\n init\n );\n const responseHeaders = headersToRecord(response.headers);\n\n if (response.status === 204 || response.status === 205) {\n return {\n status: response.status,\n body: null,\n headers: responseHeaders,\n };\n }\n\n if (response.status >= 300 && response.status < 400) {\n await response.text();\n return {\n status: response.status,\n body: null,\n headers: responseHeaders,\n };\n }\n\n const text = await response.text();\n const body = text ? (JSON.parse(text) as TResponse) : null;\n\n return {\n status: response.status,\n body,\n headers: responseHeaders,\n };\n}\n\nfunction buildUrlWithQueryParams(\n url: string,\n queryParams?: Record<string, QueryParamValues>\n): string {\n if (!queryParams) {\n return url;\n }\n\n const searchParams = new URLSearchParams();\n\n for (const [key, value] of Object.entries(queryParams)) {\n if (value === undefined || value === null) {\n continue;\n }\n\n if (Array.isArray(value)) {\n for (const item of value) {\n if (item === undefined || item === null) {\n continue;\n }\n searchParams.append(key, String(item));\n }\n continue;\n }\n\n searchParams.append(key, String(value));\n }\n\n const queryString = searchParams.toString();\n if (!queryString) {\n return url;\n }\n\n return url.includes('?') ? `${url}&${queryString}` : `${url}?${queryString}`;\n}\n\nfunction headersToRecord(headers: Headers): Record<string, string> {\n const record: Record<string, string> = {};\n headers.forEach((value, key) => {\n record[key.toLowerCase()] = value;\n });\n return record;\n}\n\nfunction concatAttributes(\n request: HttpRequest,\n attrs: Attributes\n): HttpRequest {\n const nextAttributes = Attributes.concat(\n request.attributes ?? Attributes.empty,\n attrs\n );\n const nextRequest: typeof request = {\n ...request,\n attributes: nextAttributes,\n };\n return nextRequest;\n}\n\nexport const Request = {\n concatAttributes,\n};\n","import { Attributes } from '@/shared/api/http-attributes';\nimport type { Sender } from '@/shared/api/http-client';\nimport {\n fetchAllPages,\n PaginatedResponse,\n type PaginatedResponseDto,\n PaginationParams,\n} from '@/shared/api/pagination';\nimport type { OfferDto } from '@/shared/types/dto/offer';\nimport type { OfferDetailDto } from '@/shared/types/dto/offer-detail';\nimport { Offer, type OfferId } from '@/shared/types/offer';\nimport { OfferDetail } from '@/shared/types/offer-detail';\n\nexport async function fetchOffers(api: Sender): Promise<Offer[]> {\n return fetchAllPages((params) => fetchOffersPage(api, params));\n}\n\nexport async function fetchOffersPage(\n api: Sender,\n params: PaginationParams\n): Promise<PaginatedResponse<Offer>> {\n const queryParams = PaginationParams.toQueryParams(params);\n const pageDto = await api.send<PaginatedResponseDto<OfferDto>>({\n method: 'GET',\n url: '/v1/offers',\n queryParams,\n attributes: Attributes.protected(),\n });\n return PaginatedResponse.fromDto(pageDto, Offer.fromDto);\n}\n\nexport async function fetchOfferDetails(\n api: Sender,\n id: OfferId\n): Promise<OfferDetail> {\n const dto = await api.send<OfferDetailDto>({\n method: 'GET',\n url: `/v1/offers/${id}`,\n attributes: Attributes.protected(),\n });\n return OfferDetail.fromDto(dto);\n}\n","import { Attributes } from '@/shared/api/http-attributes';\nimport type { Sender } from '@/shared/api/http-client';\nimport {\n fetchAllPages,\n PaginatedResponse,\n type PaginatedResponseDto,\n} from '@/shared/api/pagination';\nimport type { ParticipationDto } from '@/shared/types/dto/participation';\nimport type { OfferId } from '@/shared/types/offer';\nimport {\n CreateParticipationParams,\n Participation,\n type ParticipationId,\n ParticipationsPaginationParams,\n} from '@/shared/types/participation';\n\nexport async function fetchParticipations(\n api: Sender,\n offerId?: OfferId\n): Promise<Participation[]> {\n return fetchAllPages<Participation, ParticipationsPaginationParams>(\n (params) => fetchParticipationsPage(api, params),\n { offerId }\n );\n}\n\nexport async function fetchParticipationsPage(\n api: Sender,\n params: ParticipationsPaginationParams\n): Promise<PaginatedResponse<Participation>> {\n const pageDto = await api.send<PaginatedResponseDto<ParticipationDto>>({\n method: 'GET',\n url: '/v1/participations',\n queryParams: ParticipationsPaginationParams.toQueryParams(params),\n attributes: Attributes.protected(),\n });\n return PaginatedResponse.fromDto(pageDto, Participation.fromDto);\n}\n\nexport async function fetchParticipation(\n api: Sender,\n id: ParticipationId\n): Promise<Participation> {\n const dto = await api.send<ParticipationDto>({\n method: 'GET',\n url: `/v1/participations/${id}`,\n attributes: Attributes.protected(),\n });\n return Participation.fromDto(dto);\n}\n\nexport async function createParticipation(\n api: Sender,\n params: CreateParticipationParams\n): Promise<Participation> {\n const dto = await api.send<ParticipationDto>({\n method: 'POST',\n url: '/v1/participations',\n body: CreateParticipationParams.toDto(params),\n attributes: Attributes.protected(),\n });\n return Participation.fromDto(dto);\n}\n","import { Attributes } from '@/shared/api/http-attributes';\nimport type { Sender } from '@/shared/api/http-client';\nimport type {\n OfferRequirementsDto,\n RequirementStatusesDto,\n} from '@/shared/types/dto/requirement';\nimport type { OfferId } from '@/shared/types/offer';\nimport type { OfferOptionId } from '@/shared/types/offer-detail';\nimport { Requirement, RequirementStatusInfo } from '@/shared/types/requirement';\n\nexport async function fetchOfferRequirements(\n api: Sender,\n offerId: OfferId\n): Promise<Record<OfferOptionId, Requirement[]>> {\n const response = await api.send<OfferRequirementsDto>({\n method: 'GET',\n url: `/v1/offers/${offerId}/requirements`,\n attributes: Attributes.protected(),\n });\n return Object.fromEntries(\n Object.entries(response.options).map(([optionId, list]) => [\n optionId,\n list.data.map(Requirement.fromDto),\n ])\n );\n}\n\nexport async function fetchRequirementStatuses(\n api: Sender,\n offerId: OfferId\n): Promise<RequirementStatusInfo[]> {\n const response = await api.send<RequirementStatusesDto>({\n method: 'GET',\n url: `/v1/offers/${offerId}/requirements/statuses`,\n attributes: Attributes.protected(),\n });\n return RequirementStatusInfo.fromStatusesDto(response);\n}\n","import { HEADER_API_VERSION } from '@/shared/api/frontline/config';\nimport type {\n HttpClientConfig,\n HttpRequest,\n HttpResponse,\n} from '@/shared/api/http';\nimport { makeRequest } from '@/shared/api/http';\n\nexport type BeforeRequestMiddleware = (\n request: HttpRequest\n) => Promise<HttpRequest>;\n\nexport type AfterRequestMiddleware = (args: {\n request: HttpRequest;\n response: HttpResponse<unknown>;\n retry: (request?: HttpRequest) => Promise<HttpResponse<unknown>>;\n}) => Promise<HttpResponse<unknown>>;\n\nexport type HttpClientMiddleware = {\n beforeRequest?: BeforeRequestMiddleware[];\n afterRequest?: AfterRequestMiddleware[];\n};\n\nexport class HttpClient {\n constructor(\n readonly config: HttpClientConfig,\n readonly middleware: HttpClientMiddleware = {}\n ) {}\n\n async send<TResponse = unknown>(\n request: HttpRequest\n ): Promise<HttpResponse<TResponse>> {\n return this.runRequestWithAfterMiddleware<TResponse>(request);\n }\n\n /**\n * Runs beforeRequest, executeRequest, then the full afterRequest middleware\n * chain. Used by send() and by the retry() callback so that when a\n * middleware calls retry(), the retried response also goes through all\n * afterRequest middleware (e.g. session renewal, retry). Middleware\n * must use request.attributes.retryAttempt (or similar) to avoid infinite\n * recursion when they trigger retries.\n */\n private async runRequestWithAfterMiddleware<TResponse = unknown>(\n request: HttpRequest\n ): Promise<HttpResponse<TResponse>> {\n const preparedRequest = await this.runBeforeRequestMiddleware(\n this.withClientDefaults(request)\n );\n let response = await this.executeRequest<TResponse>(preparedRequest);\n\n for (const middleware of this.middleware.afterRequest ?? []) {\n response = (await middleware({\n request: preparedRequest,\n response,\n retry: (nextRequest = preparedRequest) =>\n this.runRequestWithAfterMiddleware(nextRequest) as Promise<\n HttpResponse<TResponse>\n >,\n })) as HttpResponse<TResponse>;\n }\n\n return response;\n }\n\n private withClientDefaults(request: HttpRequest): HttpRequest {\n const url = this.resolveUrl(request.url);\n const headers = {\n ...(request.headers ?? {}),\n [HEADER_API_VERSION]: this.config.xApiVersion,\n };\n\n return {\n ...request,\n url,\n headers,\n };\n }\n\n /**\n * Resolves a request URL against the client's baseUrl.\n *\n * @internal Public only for testing. Do not use in application code; use\n * {@link HttpClient.send} with a path and the client will resolve the URL.\n */\n resolveUrl(url: string): string {\n // If already absolute, use as-is.\n if (url.startsWith('http://') || url.startsWith('https://')) {\n return url;\n }\n // Otherwise append path to baseUrl so base path (e.g. /api) is preserved.\n const base = this.config.baseUrl.replace(/\\/$/, '');\n const path = url.startsWith('/') ? url : `/${url}`;\n return base + path;\n }\n\n private async runBeforeRequestMiddleware(\n initialRequest: HttpRequest\n ): Promise<HttpRequest> {\n let request = initialRequest;\n for (const middleware of this.middleware.beforeRequest ?? []) {\n request = await middleware(request);\n }\n\n return request;\n }\n\n private executeRequest<TResponse = unknown>(\n request: HttpRequest\n ): Promise<HttpResponse<TResponse>> {\n return makeRequest<TResponse>(request);\n }\n}\n\n/**\n * Structural interface satisfied by both {@link AuthenticatedApiClient} and\n * {@link ApiClient}. Used by the shared frontline API functions so they can\n * be called from either the client or server without any browser dependencies.\n */\nexport interface Sender {\n send<T>(request: HttpRequest): Promise<T>;\n}\n","import type { HttpRequest } from '@/shared/api/http';\nimport { Attributes } from '@/shared/api/http-attributes';\nimport type { BeforeRequestMiddleware } from '@/shared/api/http-client';\nimport type { OAuthAccessToken } from '@/shared/types/oauth-session';\n\nexport function attachSessionMiddleware(\n fetchAccessToken: (refresh: boolean) => Promise<OAuthAccessToken | null>\n): BeforeRequestMiddleware {\n return async (request: HttpRequest): Promise<HttpRequest> => {\n if (!Attributes.isProtected(request.attributes)) {\n return request;\n }\n\n const accessToken = await fetchAccessToken(false);\n if (accessToken === null) {\n return request;\n }\n\n return {\n ...request,\n headers: {\n ...(request.headers ?? {}),\n Authorization: `Bearer ${accessToken.value}`,\n },\n };\n };\n}\n","import { HEADER_IDEMPOTENCY_KEY } from '@/shared/api/frontline/config';\nimport type { HttpRequest } from '@/shared/api/http';\nimport { Attributes } from '@/shared/api/http-attributes';\nimport type { BeforeRequestMiddleware } from '@/shared/api/http-client';\nimport { getUUIDv4 } from '@/shared/utils';\n\nexport const idempotencyKeyMiddleware: BeforeRequestMiddleware = async (\n request: HttpRequest\n): Promise<HttpRequest> => {\n if (!Attributes.isIdempotent(request.attributes)) {\n return request;\n }\n\n const existingHeaders = request.headers ?? {};\n if (existingHeaders[HEADER_IDEMPOTENCY_KEY]) {\n return request;\n }\n\n return {\n ...request,\n headers: {\n ...existingHeaders,\n [HEADER_IDEMPOTENCY_KEY]: getUUIDv4(),\n },\n };\n};\n","import { Request } from '@/shared/api/http';\nimport { Attributes } from '@/shared/api/http-attributes';\nimport type { AfterRequestMiddleware } from '@/shared/api/http-client';\n\nconst MAX_ATTEMPTS = 3;\nconst INITIAL_DELAY_MS = 300;\nconst MAX_DELAY_MS = 2000;\n\nconst RETRYABLE_4XX = new Set([408, 409, 429]);\n\nexport function isRetryableStatus(status: number): boolean {\n return (status >= 500 && status < 600) || RETRYABLE_4XX.has(status);\n}\n\nfunction getRetryDelayMs(attempt: number): number {\n return Math.min(INITIAL_DELAY_MS * 2 ** (attempt - 1), MAX_DELAY_MS);\n}\n\nexport type RequestRetryMiddlewareOptions = {\n /**\n * Optional delay function. Defaults to real setTimeout-based delay.\n * Use a no-op (e.g. () => Promise.resolve()) in tests to avoid slow tests.\n */\n delayFn?: (ms: number) => Promise<void>;\n};\n\n/**\n * Creates the request retry after-request middleware. Inject a no-op delayFn\n * in tests to avoid real delays (unit testing best practice).\n */\nexport function createRequestRetryMiddleware(\n options: RequestRetryMiddlewareOptions = {}\n): AfterRequestMiddleware {\n const delayFn = options.delayFn ?? defaultDelay;\n\n return async ({ request, response, retry }) => {\n if (!isRetryableStatus(response.status)) {\n return response;\n }\n\n const currentAttempt = Attributes.getRetryAttempt(request.attributes);\n if (currentAttempt >= MAX_ATTEMPTS - 1) {\n return response;\n }\n\n const nextAttempt = currentAttempt + 1;\n await delayFn(getRetryDelayMs(nextAttempt));\n\n const nextRequest = Request.concatAttributes(\n request,\n Attributes.retryAttempt(nextAttempt)\n );\n return retry(nextRequest);\n };\n}\n\nfunction defaultDelay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * Retries the request up to 3 times with exponential backoff when the response\n * has a retryable status (5xx server errors). Uses request.attributes.retryAttempt\n * to decide delay and whether to retry, so the middleware does not loop when\n * retry() runs the full HTTP middleware chain again.\n */\nexport const requestRetryMiddleware: AfterRequestMiddleware =\n createRequestRetryMiddleware();\n","import { Request } from '@/shared/api/http';\nimport { Attributes } from '@/shared/api/http-attributes';\nimport type { AfterRequestMiddleware } from '@/shared/api/http-client';\nimport type { OAuthAccessToken } from '@/shared/types/oauth-session';\n\nexport function renewSessionMiddleware(\n fetchAccessToken: (refresh: boolean) => Promise<OAuthAccessToken | null>\n): AfterRequestMiddleware {\n return async ({ request, response, retry }) => {\n if (response.status !== 401) {\n return response;\n }\n if (!Attributes.isProtected(request.attributes)) {\n return response;\n }\n if (Attributes.wasRenewAttempted(request.attributes)) {\n return response;\n }\n\n const newToken = await fetchAccessToken(true);\n if (newToken) {\n const nextRequest = Request.concatAttributes(\n request,\n Attributes.renewAttempted(true)\n );\n return retry(nextRequest);\n } else {\n return response;\n }\n };\n}\n","import type { HttpClientConfig, HttpRequest } from '@/shared/api/http';\nimport { HttpError } from '@/shared/api/http';\nimport type { BeforeRequestMiddleware } from '@/shared/api/http-client';\nimport { HttpClient } from '@/shared/api/http-client';\nimport { attachSessionMiddleware } from '@/shared/api/middleware/attach-session-middleware';\nimport { idempotencyKeyMiddleware } from '@/shared/api/middleware/idempotency-key';\nimport { requestRetryMiddleware } from '@/shared/api/middleware/request-retry';\nimport { renewSessionMiddleware } from '@/shared/api/middleware/session-renewal';\nimport type { OAuthAccessToken } from '@/shared/types/oauth-session';\n\n/**\n * Isomorphic HTTP client with session attachment, session renewal on 401,\n * idempotency key injection, and request retry. Works in both browser and\n * Node/server environments. Pass `additionalBeforeRequest` to inject\n * environment-specific middleware (e.g. `userAgentMiddleware` on the client).\n */\nexport class AuthenticatedApiClient {\n private readonly httpClient: HttpClient;\n\n constructor(\n config: HttpClientConfig,\n fetchAccessToken: (refresh: boolean) => Promise<OAuthAccessToken | null>,\n additionalBeforeRequest: BeforeRequestMiddleware[] = []\n ) {\n this.httpClient = new HttpClient(config, {\n beforeRequest: [\n attachSessionMiddleware(fetchAccessToken),\n ...additionalBeforeRequest,\n idempotencyKeyMiddleware,\n ],\n afterRequest: [\n renewSessionMiddleware(fetchAccessToken),\n requestRetryMiddleware,\n ],\n });\n }\n\n async send<TResponse>(request: HttpRequest): Promise<TResponse> {\n const response = await this.httpClient.send<TResponse>(request);\n if (response.status >= 200 && response.status < 300) {\n return response.body as TResponse;\n } else {\n throw new HttpError(response);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAO,IAAM,sBAAsB;AAC5B,IAAM,qBAAqB;AAC3B,IAAM,oBAAoB;AAC1B,IAAM,yBAAyB;AAC/B,IAAM,cAAc;AAEpB,IAAM,oB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