@coinlist-co/react 0.3.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 (71) hide show
  1. package/dist/chunk-CRACFEJ4.js +17 -0
  2. package/dist/chunk-CRACFEJ4.js.map +1 -0
  3. package/dist/{chunk-GRVV7NLV.js → chunk-N3WBC2VS.js} +218 -28
  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 +1393 -372
  8. package/dist/client/index.cjs.map +1 -1
  9. package/dist/client/index.d.cts +526 -10
  10. package/dist/client/index.d.ts +526 -10
  11. package/dist/client/index.js +1464 -88
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/requirement-BEO42QOr.d.cts +387 -0
  14. package/dist/requirement-BEO42QOr.d.ts +387 -0
  15. package/dist/server/index.cjs +459 -36
  16. package/dist/server/index.cjs.map +1 -1
  17. package/dist/server/index.d.cts +56 -4
  18. package/dist/server/index.d.ts +56 -4
  19. package/dist/server/index.js +69 -37
  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 +38 -19
  26. package/dist/shared/index.js.map +1 -0
  27. package/package.json +7 -22
  28. package/dist/RequirementItem-BpkJQep8.d.ts +0 -37
  29. package/dist/RequirementItem-BvwsFu9e.d.cts +0 -37
  30. package/dist/chunk-GRVV7NLV.js.map +0 -1
  31. package/dist/chunk-IADBIDY6.js +0 -76
  32. package/dist/chunk-IADBIDY6.js.map +0 -1
  33. package/dist/chunk-IDCROXPS.js +0 -412
  34. package/dist/chunk-IDCROXPS.js.map +0 -1
  35. package/dist/chunk-P4DTIPEX.js +0 -623
  36. package/dist/chunk-P4DTIPEX.js.map +0 -1
  37. package/dist/chunk-V5M7SA3C.js +0 -161
  38. package/dist/chunk-V5M7SA3C.js.map +0 -1
  39. package/dist/chunk-YJQMJFA7.js +0 -16
  40. package/dist/chunk-YJQMJFA7.js.map +0 -1
  41. package/dist/client/components/index.cjs +0 -1107
  42. package/dist/client/components/index.cjs.map +0 -1
  43. package/dist/client/components/index.d.cts +0 -121
  44. package/dist/client/components/index.d.ts +0 -121
  45. package/dist/client/components/index.js +0 -586
  46. package/dist/client/components/index.js.map +0 -1
  47. package/dist/client/core/index.cjs +0 -961
  48. package/dist/client/core/index.cjs.map +0 -1
  49. package/dist/client/core/index.d.cts +0 -23
  50. package/dist/client/core/index.d.ts +0 -23
  51. package/dist/client/core/index.js.map +0 -1
  52. package/dist/client/hooks/index.cjs +0 -233
  53. package/dist/client/hooks/index.cjs.map +0 -1
  54. package/dist/client/hooks/index.d.cts +0 -33
  55. package/dist/client/hooks/index.d.ts +0 -33
  56. package/dist/client/hooks/index.js +0 -19
  57. package/dist/client/hooks/index.js.map +0 -1
  58. package/dist/coinlist-client-B_dJkbwB.d.ts +0 -283
  59. package/dist/coinlist-client-DBKa6j3f.d.cts +0 -283
  60. package/dist/newtype-yKTvFdg_.d.cts +0 -6
  61. package/dist/newtype-yKTvFdg_.d.ts +0 -6
  62. package/dist/oauth-session-DgItaMKN.d.cts +0 -56
  63. package/dist/oauth-session-DnKDI5ou.d.ts +0 -56
  64. package/dist/requirement-CxbdY8l4.d.cts +0 -202
  65. package/dist/requirement-fJsQ3f9_.d.ts +0 -202
  66. package/dist/useCoinListOffers-C5lBlzcC.d.ts +0 -27
  67. package/dist/useCoinListOffers-CguwXaCX.d.cts +0 -27
  68. package/dist/useCoinListRequirements-BECx1cIw.d.ts +0 -31
  69. package/dist/useCoinListRequirements-CX2gV9gJ.d.cts +0 -31
  70. package/dist/useCompleteCoinListOAuth-BRhAqD4_.d.cts +0 -55
  71. package/dist/useCompleteCoinListOAuth-DEZpHjd6.d.ts +0 -55
@@ -0,0 +1,375 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/shared/index.ts
21
+ var shared_exports = {};
22
+ __export(shared_exports, {
23
+ Asset: () => Asset,
24
+ AssetCode: () => AssetCode,
25
+ AssetId: () => AssetId,
26
+ AuthorizationCode: () => AuthorizationCode,
27
+ Blockchain: () => Blockchain,
28
+ ClientId: () => ClientId,
29
+ ClientSecret: () => ClientSecret,
30
+ CodeChallenge: () => CodeChallenge,
31
+ CodeVerifier: () => CodeVerifier,
32
+ CreateParticipationParams: () => CreateParticipationParams,
33
+ Cursor: () => Cursor,
34
+ FaqItem: () => FaqItem,
35
+ Link: () => Link,
36
+ Milestone: () => Milestone,
37
+ NotAuthenticatedError: () => NotAuthenticatedError,
38
+ NotImplementedError: () => NotImplementedError,
39
+ OAuthRefreshToken: () => OAuthRefreshToken,
40
+ OAuthSession: () => OAuthSession,
41
+ Offer: () => Offer,
42
+ OfferDetail: () => OfferDetail,
43
+ OfferId: () => OfferId,
44
+ OfferOption: () => OfferOption,
45
+ OfferOptionId: () => OfferOptionId,
46
+ OfferOptionSlug: () => OfferOptionSlug,
47
+ OfferSlug: () => OfferSlug,
48
+ PaginatedResponse: () => PaginatedResponse,
49
+ PaginationParams: () => PaginationParams,
50
+ Participation: () => Participation,
51
+ ParticipationId: () => ParticipationId,
52
+ ParticipationsPaginationParams: () => ParticipationsPaginationParams,
53
+ RedirectUri: () => RedirectUri,
54
+ Requirement: () => Requirement,
55
+ RequirementId: () => RequirementId,
56
+ RequirementStatusInfo: () => RequirementStatusInfo,
57
+ TermItem: () => TermItem,
58
+ User: () => User,
59
+ UserEmail: () => UserEmail,
60
+ UserId: () => UserId,
61
+ WalletAddress: () => WalletAddress,
62
+ fetchAllPages: () => fetchAllPages
63
+ });
64
+ module.exports = __toCommonJS(shared_exports);
65
+
66
+ // src/shared/api/pagination.ts
67
+ var Cursor = (value) => value;
68
+ async function fetchAllPages(fetchPage, baseParams) {
69
+ const items = [];
70
+ let cursor = null;
71
+ do {
72
+ const params = {
73
+ ...baseParams ?? {},
74
+ after: cursor ?? void 0
75
+ };
76
+ const page = await fetchPage(params);
77
+ items.push(...page.data);
78
+ cursor = page.startingAfter;
79
+ } while (cursor);
80
+ return items;
81
+ }
82
+ var PaginatedResponse = {
83
+ fromDto: (dto, itemMapper) => ({
84
+ data: dto.data.map(itemMapper),
85
+ startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,
86
+ startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null
87
+ })
88
+ };
89
+ var PaginationParams = {
90
+ toQueryParams: (params) => {
91
+ const queryParams = {};
92
+ if (params.after) {
93
+ queryParams.starting_after = params.after;
94
+ }
95
+ if (params.before) {
96
+ queryParams.starting_before = params.before;
97
+ }
98
+ if (params.limit) {
99
+ queryParams.limit = params.limit;
100
+ }
101
+ return queryParams;
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/errors.ts
118
+ var NotImplementedError = class extends Error {
119
+ constructor(message = "Not implemented yet") {
120
+ super(message);
121
+ this.name = "NotImplementedError";
122
+ }
123
+ };
124
+ var NotAuthenticatedError = class extends Error {
125
+ constructor(message = "The user is not authenticated. Go through the OAuth flow first!") {
126
+ super(message);
127
+ this.name = "NotAuthenticatedError";
128
+ }
129
+ };
130
+
131
+ // src/shared/types/oauth.ts
132
+ var AuthorizationCode = (value) => value;
133
+ var CodeVerifier = (value) => value;
134
+ var CodeChallenge = (value) => value;
135
+ var RedirectUri = (value) => value;
136
+ var ClientId = (value) => value;
137
+ var ClientSecret = (value) => value;
138
+
139
+ // src/shared/types/oauth-session.ts
140
+ var OAuthRefreshToken = (value) => value;
141
+ var OAuthSession = {
142
+ fromDto: (dto) => {
143
+ const expiresAt = new Date(Date.now() + dto.expires_in * 1e3);
144
+ return {
145
+ accessToken: {
146
+ value: dto.access_token,
147
+ expiresAt
148
+ },
149
+ ...dto.refresh_token != null && dto.refresh_token !== "" ? { refreshToken: OAuthRefreshToken(dto.refresh_token) } : void 0
150
+ };
151
+ }
152
+ };
153
+
154
+ // src/shared/utils.ts
155
+ function notBlankStringOrNull(value) {
156
+ if (value?.trim()) {
157
+ return value;
158
+ } else {
159
+ return null;
160
+ }
161
+ }
162
+
163
+ // src/shared/types/offer.ts
164
+ var OfferId = (value) => value;
165
+ var OfferSlug = (value) => value;
166
+ var Offer = {
167
+ fromDto: (dto) => ({
168
+ id: OfferId(dto.id),
169
+ slug: OfferSlug(dto.slug),
170
+ tagline: notBlankStringOrNull(dto.tagline),
171
+ bannerUrl: notBlankStringOrNull(dto.banner_url),
172
+ logoUrl: notBlankStringOrNull(dto.logo_url),
173
+ startsAt: new Date(dto.starts_at),
174
+ endsAt: new Date(dto.ends_at)
175
+ })
176
+ };
177
+
178
+ // src/shared/types/offer-detail.ts
179
+ var OfferOptionId = (value) => value;
180
+ var OfferOptionSlug = (value) => value;
181
+ var OfferDetail = {
182
+ fromDto: (dto) => {
183
+ if (!Array.isArray(dto.funding_assets)) {
184
+ throw new Error(`funding_assets must be an array`);
185
+ }
186
+ if (!Array.isArray(dto.options)) {
187
+ throw new Error(`options must be an array`);
188
+ }
189
+ if (!Array.isArray(dto.terms)) {
190
+ throw new Error(`terms must be an array`);
191
+ }
192
+ if (!Array.isArray(dto.links)) {
193
+ throw new Error(`links must be an array`);
194
+ }
195
+ if (!Array.isArray(dto.faqs)) {
196
+ throw new Error(`faqs must be an array`);
197
+ }
198
+ if (!Array.isArray(dto.milestones)) {
199
+ throw new Error(`milestones must be an array`);
200
+ }
201
+ return {
202
+ id: OfferId(dto.id),
203
+ slug: OfferSlug(dto.slug),
204
+ name: dto.name,
205
+ asset: Asset.fromDto(dto.asset),
206
+ fundingAssets: dto.funding_assets.map(Asset.fromDto),
207
+ about: notBlankStringOrNull(dto.about),
208
+ tagline: notBlankStringOrNull(dto.tagline),
209
+ bannerUrl: notBlankStringOrNull(dto.banner_url),
210
+ logoUrl: notBlankStringOrNull(dto.logo_url),
211
+ category: notBlankStringOrNull(dto.category),
212
+ startsAt: new Date(dto.starts_at),
213
+ endsAt: new Date(dto.ends_at),
214
+ faqs: dto.faqs.map(FaqItem.fromDto),
215
+ links: dto.links.map(Link.fromDto),
216
+ milestones: dto.milestones.map(Milestone.fromDto),
217
+ options: dto.options.map(OfferOption.fromDto),
218
+ terms: dto.terms.map(TermItem.fromDto)
219
+ };
220
+ }
221
+ };
222
+ var OfferOption = {
223
+ fromDto: (dto) => ({
224
+ id: OfferOptionId(dto.id),
225
+ slug: OfferOptionSlug(dto.slug),
226
+ bidIncrement: dto.bid_increment,
227
+ floorPriceUsd: dto.floor_price_usd,
228
+ minimumPurchaseUsd: dto.minimum_purchase_usd,
229
+ priceUsd: dto.price_usd,
230
+ saleAgreementUrl: notBlankStringOrNull(dto.sale_agreement_url),
231
+ totalTokenSupply: dto.total_token_supply
232
+ })
233
+ };
234
+ var FaqItem = {
235
+ fromDto: (dto) => ({
236
+ question: notBlankStringOrNull(dto.question),
237
+ answer: notBlankStringOrNull(dto.answer)
238
+ })
239
+ };
240
+ var Link = {
241
+ fromDto: (dto) => ({
242
+ label: notBlankStringOrNull(dto.label),
243
+ url: notBlankStringOrNull(dto.url)
244
+ })
245
+ };
246
+ var TermItem = {
247
+ fromDto: (dto) => ({
248
+ key: notBlankStringOrNull(dto.key),
249
+ value: notBlankStringOrNull(dto.value)
250
+ })
251
+ };
252
+ var Milestone = {
253
+ fromDto: (dto) => ({
254
+ name: notBlankStringOrNull(dto.name),
255
+ schedule: notBlankStringOrNull(dto.schedule),
256
+ status: dto.status
257
+ })
258
+ };
259
+
260
+ // src/shared/types/participation.ts
261
+ var ParticipationId = (value) => value;
262
+ var Blockchain = (value) => value;
263
+ var WalletAddress = (value) => value;
264
+ var ParticipationsPaginationParams = {
265
+ toQueryParams: (params) => {
266
+ const queryParams = PaginationParams.toQueryParams(params);
267
+ if (params.offerId) {
268
+ queryParams["filters[0][field]"] = "offer_id";
269
+ queryParams["filters[0][op]"] = "==";
270
+ queryParams["filters[0][value]"] = params.offerId;
271
+ }
272
+ return queryParams;
273
+ }
274
+ };
275
+ var Participation = {
276
+ /** Maps API DTO shape into the SDK participation domain model. */
277
+ fromDto: (dto) => {
278
+ const walletAddress = notBlankStringOrNull(dto.wallet_address);
279
+ return {
280
+ id: ParticipationId(dto.id),
281
+ offerId: OfferId(dto.offer_id),
282
+ offerOptionId: OfferOptionId(dto.offer_option_id),
283
+ status: dto.status,
284
+ amount: dto.amount,
285
+ displayAmount: dto.amount_string,
286
+ asset: Asset.fromDto(dto.asset),
287
+ chain: Blockchain(dto.chain),
288
+ insertedAt: dto.inserted_at ? new Date(dto.inserted_at) : null,
289
+ updatedAt: dto.updated_at ? new Date(dto.updated_at) : null,
290
+ walletAddress: walletAddress ? WalletAddress(walletAddress) : null
291
+ };
292
+ }
293
+ };
294
+ var CreateParticipationParams = {
295
+ /** Maps participation creation params into API DTO payload. */
296
+ toDto: (params) => ({
297
+ offer_id: params.offerId,
298
+ offer_option_id: params.offerOptionId,
299
+ chain: params.chain,
300
+ wallet_address: params.walletAddress,
301
+ amount: params.amount,
302
+ asset_id: params.assetId,
303
+ approval_transaction_hash: params.approvalTransactionHash
304
+ })
305
+ };
306
+
307
+ // src/shared/types/requirement.ts
308
+ var RequirementId = (value) => value;
309
+ var Requirement = {
310
+ fromDto: (dto) => ({
311
+ id: RequirementId(dto.id),
312
+ type: dto.type,
313
+ details: dto.details
314
+ })
315
+ };
316
+ var RequirementStatusInfo = {
317
+ fromStatusesDto: (dto) => Object.entries(dto.statuses).map(([id, status]) => ({
318
+ id: RequirementId(id),
319
+ status
320
+ }))
321
+ };
322
+
323
+ // src/shared/types/user.ts
324
+ var UserId = (value) => value;
325
+ var UserEmail = (value) => value;
326
+ var User = {
327
+ fromDto: (dto) => ({
328
+ id: UserId(dto.id),
329
+ email: UserEmail(dto.email)
330
+ })
331
+ };
332
+ // Annotate the CommonJS export names for ESM import in node:
333
+ 0 && (module.exports = {
334
+ Asset,
335
+ AssetCode,
336
+ AssetId,
337
+ AuthorizationCode,
338
+ Blockchain,
339
+ ClientId,
340
+ ClientSecret,
341
+ CodeChallenge,
342
+ CodeVerifier,
343
+ CreateParticipationParams,
344
+ Cursor,
345
+ FaqItem,
346
+ Link,
347
+ Milestone,
348
+ NotAuthenticatedError,
349
+ NotImplementedError,
350
+ OAuthRefreshToken,
351
+ OAuthSession,
352
+ Offer,
353
+ OfferDetail,
354
+ OfferId,
355
+ OfferOption,
356
+ OfferOptionId,
357
+ OfferOptionSlug,
358
+ OfferSlug,
359
+ PaginatedResponse,
360
+ PaginationParams,
361
+ Participation,
362
+ ParticipationId,
363
+ ParticipationsPaginationParams,
364
+ RedirectUri,
365
+ Requirement,
366
+ RequirementId,
367
+ RequirementStatusInfo,
368
+ TermItem,
369
+ User,
370
+ UserEmail,
371
+ UserId,
372
+ WalletAddress,
373
+ fetchAllPages
374
+ });
375
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/shared/index.ts","../../src/shared/api/pagination.ts","../../src/shared/types/asset.ts","../../src/shared/types/errors.ts","../../src/shared/types/oauth.ts","../../src/shared/types/oauth-session.ts","../../src/shared/utils.ts","../../src/shared/types/offer.ts","../../src/shared/types/offer-detail.ts","../../src/shared/types/participation.ts","../../src/shared/types/requirement.ts","../../src/shared/types/user.ts"],"sourcesContent":["export * from '@/shared/api/pagination';\nexport * from '@/shared/types/asset';\nexport * from '@/shared/types/config';\nexport * from '@/shared/types/errors';\nexport * from '@/shared/types/oauth';\nexport * from '@/shared/types/oauth-session';\nexport * from '@/shared/types/offer';\nexport * from '@/shared/types/offer-detail';\nexport * from '@/shared/types/participation';\nexport * from '@/shared/types/requirement';\nexport * from '@/shared/types/user';\n","import type { QueryParamValue } from '@/shared/api/http';\nimport type { Newtype } from '@/shared/types/newtype';\n\nexport type Cursor = Newtype<string, 'Cursor'>;\nexport const Cursor = (value: string) => value as Cursor;\n\n/**\n * Cursor-based pagination input used when requesting paginated API resources.\n * Set `after` or `before` to navigate relative to a known cursor, and `limit`\n * to control the maximum number of returned items.\n */\nexport interface PaginationParams {\n before?: Cursor;\n after?: Cursor;\n limit?: number;\n}\n\nexport interface PaginatedResponseDto<T> {\n data: T[];\n starting_after?: string;\n starting_before?: string;\n}\n\nexport interface PaginatedResponse<T> {\n data: T[];\n startingAfter: Cursor | null;\n startingBefore: Cursor | null;\n}\n\nexport async function fetchAllPages<\n A,\n P extends PaginationParams = PaginationParams,\n>(\n fetchPage: (params: P) => Promise<PaginatedResponse<A>>,\n baseParams?: Omit<P, keyof PaginationParams>\n): Promise<A[]> {\n const items: A[] = [];\n let cursor: Cursor | null = null;\n\n do {\n const params = {\n ...(baseParams ?? {}),\n after: cursor ?? undefined,\n } as P;\n const page = await fetchPage(params);\n items.push(...page.data);\n cursor = page.startingAfter;\n } while (cursor);\n\n return items;\n}\n\nexport const PaginatedResponse = {\n fromDto: <A, B>(\n dto: PaginatedResponseDto<A>,\n itemMapper: (item: A) => B\n ): PaginatedResponse<B> => ({\n data: dto.data.map(itemMapper),\n startingAfter: dto.starting_after ? Cursor(dto.starting_after) : null,\n startingBefore: dto.starting_before ? Cursor(dto.starting_before) : null,\n }),\n};\n\nexport const PaginationParams = {\n toQueryParams: (\n params: PaginationParams\n ): Record<string, QueryParamValue> => {\n const queryParams: Record<string, QueryParamValue> = {};\n if (params.after) {\n queryParams.starting_after = params.after;\n }\n if (params.before) {\n queryParams.starting_before = params.before;\n }\n if (params.limit) {\n queryParams.limit = params.limit;\n }\n return queryParams;\n },\n};\n","import type { AssetDto } from '@/shared/types/dto/asset';\nimport type { Newtype } from '@/shared/types/newtype';\n\nexport type AssetId = Newtype<string, 'AssetId'>;\nexport const AssetId = (value: string) => value as AssetId;\n\nexport type AssetCode = Newtype<string, 'AssetCode'>;\nexport const AssetCode = (value: string) => value as AssetCode;\n\nexport type Asset = {\n id: AssetId;\n code: AssetCode;\n name: string;\n fractionalDigits: number;\n};\n\nexport const Asset = {\n fromDto: (dto: AssetDto): Asset => ({\n id: AssetId(dto.id),\n code: AssetCode(dto.code),\n name: dto.name,\n fractionalDigits: dto.fractional_digits,\n }),\n};\n","/**\n * Error thrown when a feature or code path is not yet implemented.\n */\nexport class NotImplementedError extends Error {\n constructor(message = 'Not implemented yet') {\n super(message);\n this.name = 'NotImplementedError';\n }\n}\n\n/**\n * Error thrown when accessing a feature that requires authentication\n * without being authenticated.\n */\nexport class NotAuthenticatedError extends Error {\n constructor(\n message = 'The user is not authenticated. Go through the OAuth flow first!'\n ) {\n super(message);\n this.name = 'NotAuthenticatedError';\n }\n}\n","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","import type { OAuthSessionDto } from '@/shared/types/dto/oauth-session';\nimport type { Newtype } from '@/shared/types/newtype';\n\nexport type OAuthAccessToken = {\n value: string;\n expiresAt: Date;\n};\n\nexport type OAuthRefreshToken = Newtype<string, 'OAuthRefreshToken'>;\nexport const OAuthRefreshToken = (value: string) => value as OAuthRefreshToken;\n\nexport type OAuthSession = {\n accessToken: OAuthAccessToken;\n refreshToken?: OAuthRefreshToken;\n};\n\nexport const OAuthSession = {\n fromDto: (dto: OAuthSessionDto): OAuthSession => {\n const expiresAt = new Date(Date.now() + dto.expires_in * 1000);\n return {\n accessToken: {\n value: dto.access_token,\n expiresAt,\n },\n ...(dto.refresh_token != null && dto.refresh_token !== ''\n ? { refreshToken: OAuthRefreshToken(dto.refresh_token) }\n : undefined),\n };\n },\n};\n","/**\n * Computes SHA-256 digest of the input (UTF-8 string or raw bytes).\n * Uses the Web Crypto API.\n */\nexport async function sha256(data: string | Uint8Array): Promise<ArrayBuffer> {\n const bytes =\n typeof data === 'string' ? new TextEncoder().encode(data) : data;\n const buffer = bytes.buffer.slice(\n bytes.byteOffset,\n bytes.byteOffset + bytes.byteLength\n ) as ArrayBuffer;\n return crypto.subtle.digest('SHA-256', buffer);\n}\n\n/**\n * Converts an ArrayBuffer to Base64-URL encoding (RFC 4648).\n * @param padding - If false, omits trailing '=' padding (e.g. for PKCE).\n */\nexport function arrayBufferToBase64Url(\n buffer: ArrayBuffer,\n padding: boolean = true\n): string {\n const bytes = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < bytes.length; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n let base64 = btoa(binary);\n base64 = base64.replace(/\\+/g, '-').replace(/\\//g, '_');\n if (!padding) {\n base64 = base64.replace(/=+$/, '');\n }\n return base64;\n}\n\n/**\n * Securely generates random bytes and returns them as Base64-URL (no padding).\n * Suitable for PKCE code_verifier and OAuth state.\n * @param byteLength - Number of random bytes (e.g. 32 for PKCE).\n */\nexport function generateSecureRandomBase64Url(byteLength: number): string {\n const bytes = new Uint8Array(byteLength);\n crypto.getRandomValues(bytes);\n const buffer = bytes.buffer;\n return arrayBufferToBase64Url(buffer, false);\n}\n\n/**\n * Generate a UUID v4 using the standard Web Crypto API (crypto.randomUUID).\n * Falls back to RFC 4122–compliant generation via crypto.getRandomValues in old browsers.\n */\nexport function getUUIDv4(): string {\n if (\n typeof crypto !== 'undefined' &&\n typeof crypto.randomUUID === 'function'\n ) {\n return crypto.randomUUID();\n }\n\n if (\n typeof crypto !== 'undefined' &&\n typeof crypto.getRandomValues === 'function'\n ) {\n const bytes = new Uint8Array(16);\n crypto.getRandomValues(bytes);\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0'));\n 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('')}`;\n }\n\n return `${Date.now()}-${Math.random().toString(36).slice(2, 12)}`;\n}\n\nexport function notBlankStringOrNull(value?: string | null): string | null {\n if (value?.trim()) {\n return value;\n } else {\n return null;\n }\n}\n","import type { OfferDto } from '@/shared/types/dto/offer';\nimport type { Newtype } from '@/shared/types/newtype';\nimport { notBlankStringOrNull } from '@/shared/utils';\n\nexport type OfferId = Newtype<string, 'OfferId'>;\nexport const OfferId = (value: string) => value as OfferId;\n\nexport type OfferSlug = Newtype<string, 'OfferSlug'>;\nexport const OfferSlug = (value: string) => value as OfferSlug;\n\nexport type Offer = {\n id: OfferId;\n slug: OfferSlug;\n tagline: string | null;\n bannerUrl: string | null;\n logoUrl: string | null;\n startsAt: Date;\n endsAt: Date;\n};\n\nexport const Offer = {\n fromDto: (dto: OfferDto): Offer => ({\n id: OfferId(dto.id),\n slug: OfferSlug(dto.slug),\n tagline: notBlankStringOrNull(dto.tagline),\n bannerUrl: notBlankStringOrNull(dto.banner_url),\n logoUrl: notBlankStringOrNull(dto.logo_url),\n startsAt: new Date(dto.starts_at),\n endsAt: new Date(dto.ends_at),\n }),\n};\n","import { Asset } from '@/shared/types/asset';\nimport type {\n OfferDetailDto,\n OfferDetailFaqDto,\n OfferDetailLinkDto,\n OfferDetailMilestoneDto,\n OfferDetailOptionDto,\n OfferDetailTermDto,\n} from '@/shared/types/dto/offer-detail';\nimport type { Newtype } from '@/shared/types/newtype';\nimport { OfferId, OfferSlug } from '@/shared/types/offer';\nimport { notBlankStringOrNull } from '@/shared/utils';\n\nexport type OfferDetail = {\n id: OfferId;\n slug: OfferSlug;\n name: string;\n\n asset: Asset;\n fundingAssets: Asset[];\n\n about: string | null;\n tagline: string | null;\n bannerUrl: string | null;\n logoUrl: string | null;\n category: string | null;\n\n startsAt: Date;\n endsAt: Date;\n\n faqs: FaqItem[];\n links: Link[];\n milestones: Milestone[];\n options: OfferOption[];\n terms: TermItem[];\n};\n\nexport type OfferOptionId = Newtype<string, 'OfferOptionId'>;\nexport const OfferOptionId = (value: string) => value as OfferOptionId;\n\nexport type OfferOptionSlug = Newtype<string, 'OfferOptionSlug'>;\nexport const OfferOptionSlug = (value: string) => value as OfferOptionSlug;\n\nexport type OfferOption = {\n id: OfferOptionId;\n slug: OfferOptionSlug;\n bidIncrement: number | null;\n floorPriceUsd: number | null;\n minimumPurchaseUsd: number | null;\n priceUsd: string | null;\n saleAgreementUrl: string | null;\n totalTokenSupply: number | null;\n};\n\nexport type FaqItem = {\n question: string | null;\n answer: string | null;\n};\n\nexport type TermItem = {\n key: string | null;\n value: string | null;\n};\n\nexport type Milestone = {\n name: string | null;\n schedule: string | null;\n status: 'completed' | 'active' | 'upcoming';\n};\n\nexport type Link = {\n label: string | null;\n url: string | null;\n};\n\nexport const OfferDetail = {\n fromDto: (dto: OfferDetailDto): OfferDetail => {\n if (!Array.isArray(dto.funding_assets)) {\n throw new Error(`funding_assets must be an array`);\n }\n\n if (!Array.isArray(dto.options)) {\n throw new Error(`options must be an array`);\n }\n\n if (!Array.isArray(dto.terms)) {\n throw new Error(`terms must be an array`);\n }\n\n if (!Array.isArray(dto.links)) {\n throw new Error(`links must be an array`);\n }\n\n if (!Array.isArray(dto.faqs)) {\n throw new Error(`faqs must be an array`);\n }\n\n if (!Array.isArray(dto.milestones)) {\n throw new Error(`milestones must be an array`);\n }\n\n return {\n id: OfferId(dto.id),\n slug: OfferSlug(dto.slug),\n name: dto.name,\n\n asset: Asset.fromDto(dto.asset),\n fundingAssets: dto.funding_assets.map(Asset.fromDto),\n\n about: notBlankStringOrNull(dto.about),\n tagline: notBlankStringOrNull(dto.tagline),\n bannerUrl: notBlankStringOrNull(dto.banner_url),\n logoUrl: notBlankStringOrNull(dto.logo_url),\n category: notBlankStringOrNull(dto.category),\n\n startsAt: new Date(dto.starts_at),\n endsAt: new Date(dto.ends_at),\n\n faqs: dto.faqs.map(FaqItem.fromDto),\n links: dto.links.map(Link.fromDto),\n milestones: dto.milestones.map(Milestone.fromDto),\n options: dto.options.map(OfferOption.fromDto),\n terms: dto.terms.map(TermItem.fromDto),\n };\n },\n};\n\nexport const OfferOption = {\n fromDto: (dto: OfferDetailOptionDto): OfferOption => ({\n id: OfferOptionId(dto.id),\n slug: OfferOptionSlug(dto.slug),\n bidIncrement: dto.bid_increment,\n floorPriceUsd: dto.floor_price_usd,\n minimumPurchaseUsd: dto.minimum_purchase_usd,\n priceUsd: dto.price_usd,\n saleAgreementUrl: notBlankStringOrNull(dto.sale_agreement_url),\n totalTokenSupply: dto.total_token_supply,\n }),\n};\n\nexport const FaqItem = {\n fromDto: (dto: OfferDetailFaqDto): FaqItem => ({\n question: notBlankStringOrNull(dto.question),\n answer: notBlankStringOrNull(dto.answer),\n }),\n};\n\nexport const Link = {\n fromDto: (dto: OfferDetailLinkDto): Link => ({\n label: notBlankStringOrNull(dto.label),\n url: notBlankStringOrNull(dto.url),\n }),\n};\n\nexport const TermItem = {\n fromDto: (dto: OfferDetailTermDto): TermItem => ({\n key: notBlankStringOrNull(dto.key),\n value: notBlankStringOrNull(dto.value),\n }),\n};\n\nexport const Milestone = {\n fromDto: (dto: OfferDetailMilestoneDto): Milestone => ({\n name: notBlankStringOrNull(dto.name),\n schedule: notBlankStringOrNull(dto.schedule),\n status: dto.status,\n }),\n};\n","import type { QueryParamValue } from '@/shared/api/http';\nimport { PaginationParams } from '@/shared/api/pagination';\nimport { Asset, type AssetId } from '@/shared/types/asset';\nimport type {\n CreateParticipationDto,\n ParticipationDto,\n ParticipationStatusDto,\n} from '@/shared/types/dto/participation';\nimport type { Newtype } from '@/shared/types/newtype';\nimport { OfferId, type OfferId as OfferIdType } from '@/shared/types/offer';\nimport {\n OfferOptionId,\n type OfferOptionId as OfferOptionIdType,\n} from '@/shared/types/offer-detail';\nimport { notBlankStringOrNull } from '@/shared/utils';\n\n/** Unique identifier for a participation. */\nexport type ParticipationId = Newtype<string, 'ParticipationId'>;\n/** Casts a string into a typed {@link ParticipationId}. */\nexport const ParticipationId = (value: string) => value as ParticipationId;\n\n/** Blockchain identifier for where a participation is funded. */\nexport type Blockchain = Newtype<string, 'Blockchain'>;\n/** Casts a string into a typed {@link Blockchain}. */\nexport const Blockchain = (value: string) => value as Blockchain;\n\n/** Wallet address used for a participation. */\nexport type WalletAddress = Newtype<string, 'WalletAddress'>;\n/** Casts a string into a typed {@link WalletAddress}. */\nexport const WalletAddress = (value: string) => value as WalletAddress;\n\n/** Possible participation lifecycle states returned by the API. */\nexport type ParticipationStatus = ParticipationStatusDto;\n\n/** Domain model for a participation returned by CoinList APIs. */\nexport type Participation = {\n /** Unique participation id. */\n id: ParticipationId;\n /** Parent offer id. */\n offerId: OfferIdType;\n /** Selected offer option id. */\n offerOptionId: OfferOptionIdType;\n /** Current processing status. */\n status: ParticipationStatus;\n /** Raw participation amount from API. */\n amount: string;\n /** Human-readable formatted amount from API. */\n displayAmount: string;\n /** Asset metadata for the participation amount. */\n asset: Asset;\n /** Funding chain identifier. */\n chain: Blockchain;\n /** Creation timestamp, if returned by API. */\n insertedAt: Date | null;\n /** Last update timestamp, if returned by API. */\n updatedAt: Date | null;\n /** Wallet used for participation, blank values normalized to null. */\n walletAddress: WalletAddress | null;\n};\n\n/** Parameters required to create a new participation. */\nexport type CreateParticipationParams = {\n /** Offer to participate in. */\n offerId: OfferIdType;\n /** Offer option selected for participation. */\n offerOptionId: OfferOptionIdType;\n /** Blockchain for funding. */\n chain: Blockchain;\n /** Wallet address that funds the participation. */\n walletAddress: WalletAddress;\n /** Raw amount to participate with. */\n amount: string;\n /** Funding asset id. */\n assetId: AssetId;\n /** Optional approval transaction hash, if applicable. */\n approvalTransactionHash?: string | null;\n};\n\n/** Pagination params for listing participations, with an optional offer filter. */\nexport interface ParticipationsPaginationParams extends PaginationParams {\n offerId?: OfferIdType;\n}\n\nexport const ParticipationsPaginationParams = {\n toQueryParams: (\n params: ParticipationsPaginationParams\n ): Record<string, QueryParamValue> => {\n const queryParams = PaginationParams.toQueryParams(params);\n if (params.offerId) {\n queryParams['filters[0][field]'] = 'offer_id';\n queryParams['filters[0][op]'] = '==';\n queryParams['filters[0][value]'] = params.offerId;\n }\n return queryParams;\n },\n};\n\nexport const Participation = {\n /** Maps API DTO shape into the SDK participation domain model. */\n fromDto: (dto: ParticipationDto): Participation => {\n const walletAddress = notBlankStringOrNull(dto.wallet_address);\n return {\n id: ParticipationId(dto.id),\n offerId: OfferId(dto.offer_id),\n offerOptionId: OfferOptionId(dto.offer_option_id),\n status: dto.status,\n amount: dto.amount,\n displayAmount: dto.amount_string,\n asset: Asset.fromDto(dto.asset),\n chain: Blockchain(dto.chain),\n insertedAt: dto.inserted_at ? new Date(dto.inserted_at) : null,\n updatedAt: dto.updated_at ? new Date(dto.updated_at) : null,\n walletAddress: walletAddress ? WalletAddress(walletAddress) : null,\n };\n },\n};\n\nexport const CreateParticipationParams = {\n /** Maps participation creation params into API DTO payload. */\n toDto: (params: CreateParticipationParams): CreateParticipationDto => ({\n offer_id: params.offerId,\n offer_option_id: params.offerOptionId,\n chain: params.chain,\n wallet_address: params.walletAddress,\n amount: params.amount,\n asset_id: params.assetId,\n approval_transaction_hash: params.approvalTransactionHash,\n }),\n};\n","import type {\n RequirementDto,\n RequirementStatusesDto,\n RequirementStatusValueDto,\n RequirementTypeDto,\n} from '@/shared/types/dto/requirement';\nimport type { Newtype } from '@/shared/types/newtype';\n\nexport type RequirementId = Newtype<string, 'RequirementId'>;\nexport const RequirementId = (value: string) => value as RequirementId;\n\nexport type RequirementType = RequirementTypeDto;\nexport type RequirementStatusValue = RequirementStatusValueDto;\n\nexport type Requirement = {\n id: RequirementId;\n type: RequirementType;\n details: Record<string, unknown> | null;\n};\n\nexport const Requirement = {\n fromDto: (dto: RequirementDto): Requirement => ({\n id: RequirementId(dto.id),\n type: dto.type,\n details: dto.details,\n }),\n};\n\nexport type RequirementStatusInfo = {\n id: RequirementId;\n status: RequirementStatusValue;\n};\n\nexport const RequirementStatusInfo = {\n fromStatusesDto: (dto: RequirementStatusesDto): RequirementStatusInfo[] =>\n Object.entries(dto.statuses).map(([id, status]) => ({\n id: RequirementId(id),\n status,\n })),\n};\n","import type { UserDto } from '@/shared/types/dto/user';\nimport type { Newtype } from '@/shared/types/newtype';\n\nexport type UserId = Newtype<string, 'UserId'>;\nexport const UserId = (value: string) => value as UserId;\nexport type UserEmail = Newtype<string, 'UserEmail'>;\nexport const UserEmail = (value: string) => value as UserEmail;\n\nexport type User = {\n id: UserId;\n email: UserEmail;\n};\n\nexport const User = {\n fromDto: (dto: UserDto): User => ({\n id: UserId(dto.id),\n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AO;AAAA,IACxB,OAAO,OAAO;AAAA,IACd,gBAAgB,OAAO;AAAA,IACvB,QAAQ,OAAO;AAAA,IACf,UAAU,OAAO;AAAA,IACjB,2BAA2B,OAAO;AAAA,EACpC;AACF;;;ACvHO,IAAM,gBAAgB,CAAC,UAAkB;AAWzC,IAAM,cAAc;AAAA,EACzB,SAAS,CAAC,SAAsC;AAAA,IAC9C,IAAI,cAAc,IAAI,EAAE;AAAA,IACxB,MAAM,IAAI;AAAA,IACV,SAAS,IAAI;AAAA,EACf;AACF;AAOO,IAAM,wBAAwB;AAAA,EACnC,iBAAiB,CAAC,QAChB,OAAO,QAAQ,IAAI,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,MAAM,OAAO;AAAA,IAClD,IAAI,cAAc,EAAE;AAAA,IACpB;AAAA,EACF,EAAE;AACN;;;ACnCO,IAAM,SAAS,CAAC,UAAkB;AAElC,IAAM,YAAY,CAAC,UAAkB;AAOrC,IAAM,OAAO;AAAA,EAClB,SAAS,CAAC,SAAwB;AAAA,IAChC,IAAI,OAAO,IAAI,EAAE;AAAA,IACjB,OAAO,UAAU,IAAI,KAAK;AAAA,EAC5B;AACF;","names":[]}
@@ -0,0 +1,35 @@
1
+ import { N as Newtype } from '../requirement-BEO42QOr.cjs';
2
+ export { p as Asset, q as AssetCode, r as AssetId, A as AuthorizationCode, B as Blockchain, s as ClientId, o as ClientSecret, t as CodeChallenge, C as CodeVerifier, a as Config, i as CreateParticipationParams, u as Cursor, F as FaqItem, L as Link, M as Milestone, O as OAuthAccessToken, v as OAuthRefreshToken, n as OAuthSession, b as Offer, e as OfferDetail, d as OfferId, w as OfferOption, j as OfferOptionId, x as OfferOptionSlug, y as OfferSlug, c as PaginatedResponse, z as PaginatedResponseDto, P as PaginationParams, f as Participation, h as ParticipationId, D as ParticipationStatus, g as ParticipationsPaginationParams, E as RedirectUri, R as Requirement, G as RequirementId, k as RequirementStatusInfo, m as RequirementStatusValue, l as RequirementType, T as TermItem, W as WalletAddress, H as fetchAllPages } from '../requirement-BEO42QOr.cjs';
3
+
4
+ /**
5
+ * Error thrown when a feature or code path is not yet implemented.
6
+ */
7
+ declare class NotImplementedError extends Error {
8
+ constructor(message?: string);
9
+ }
10
+ /**
11
+ * Error thrown when accessing a feature that requires authentication
12
+ * without being authenticated.
13
+ */
14
+ declare class NotAuthenticatedError extends Error {
15
+ constructor(message?: string);
16
+ }
17
+
18
+ type UserDto = {
19
+ id: string;
20
+ email: string;
21
+ };
22
+
23
+ type UserId = Newtype<string, 'UserId'>;
24
+ declare const UserId: (value: string) => UserId;
25
+ type UserEmail = Newtype<string, 'UserEmail'>;
26
+ declare const UserEmail: (value: string) => UserEmail;
27
+ type User = {
28
+ id: UserId;
29
+ email: UserEmail;
30
+ };
31
+ declare const User: {
32
+ fromDto: (dto: UserDto) => User;
33
+ };
34
+
35
+ export { NotAuthenticatedError, NotImplementedError, User, UserEmail, UserId };
@@ -0,0 +1,35 @@
1
+ import { N as Newtype } from '../requirement-BEO42QOr.js';
2
+ export { p as Asset, q as AssetCode, r as AssetId, A as AuthorizationCode, B as Blockchain, s as ClientId, o as ClientSecret, t as CodeChallenge, C as CodeVerifier, a as Config, i as CreateParticipationParams, u as Cursor, F as FaqItem, L as Link, M as Milestone, O as OAuthAccessToken, v as OAuthRefreshToken, n as OAuthSession, b as Offer, e as OfferDetail, d as OfferId, w as OfferOption, j as OfferOptionId, x as OfferOptionSlug, y as OfferSlug, c as PaginatedResponse, z as PaginatedResponseDto, P as PaginationParams, f as Participation, h as ParticipationId, D as ParticipationStatus, g as ParticipationsPaginationParams, E as RedirectUri, R as Requirement, G as RequirementId, k as RequirementStatusInfo, m as RequirementStatusValue, l as RequirementType, T as TermItem, W as WalletAddress, H as fetchAllPages } from '../requirement-BEO42QOr.js';
3
+
4
+ /**
5
+ * Error thrown when a feature or code path is not yet implemented.
6
+ */
7
+ declare class NotImplementedError extends Error {
8
+ constructor(message?: string);
9
+ }
10
+ /**
11
+ * Error thrown when accessing a feature that requires authentication
12
+ * without being authenticated.
13
+ */
14
+ declare class NotAuthenticatedError extends Error {
15
+ constructor(message?: string);
16
+ }
17
+
18
+ type UserDto = {
19
+ id: string;
20
+ email: string;
21
+ };
22
+
23
+ type UserId = Newtype<string, 'UserId'>;
24
+ declare const UserId: (value: string) => UserId;
25
+ type UserEmail = Newtype<string, 'UserEmail'>;
26
+ declare const UserEmail: (value: string) => UserEmail;
27
+ type User = {
28
+ id: UserId;
29
+ email: UserEmail;
30
+ };
31
+ declare const User: {
32
+ fromDto: (dto: UserDto) => User;
33
+ };
34
+
35
+ export { NotAuthenticatedError, NotImplementedError, User, UserEmail, UserId };
@@ -1,15 +1,27 @@
1
1
  import {
2
- User,
3
- UserEmail,
4
- UserId
5
- } from "../../chunk-YJQMJFA7.js";
2
+ AuthorizationCode,
3
+ ClientId,
4
+ ClientSecret,
5
+ CodeChallenge,
6
+ CodeVerifier,
7
+ RedirectUri
8
+ } from "../chunk-CRACFEJ4.js";
9
+ import {
10
+ OAuthRefreshToken,
11
+ OAuthSession
12
+ } from "../chunk-5E3P7AMH.js";
6
13
  import {
14
+ Asset,
15
+ AssetCode,
16
+ AssetId,
7
17
  Blockchain,
8
18
  CreateParticipationParams,
9
19
  Cursor,
10
20
  FaqItem,
11
21
  Link,
12
22
  Milestone,
23
+ NotAuthenticatedError,
24
+ NotImplementedError,
13
25
  Offer,
14
26
  OfferDetail,
15
27
  OfferId,
@@ -22,24 +34,27 @@ import {
22
34
  Participation,
23
35
  ParticipationId,
24
36
  ParticipationsPaginationParams,
37
+ Requirement,
38
+ RequirementId,
39
+ RequirementStatusInfo,
25
40
  TermItem,
26
41
  WalletAddress,
27
- createCoinListClient,
28
42
  fetchAllPages
29
- } from "../../chunk-P4DTIPEX.js";
30
- import {
31
- OAuthRefreshToken,
32
- OAuthSession
33
- } from "../../chunk-5E3P7AMH.js";
34
- import {
35
- AuthorizationCode,
36
- ClientId,
37
- ClientSecret,
38
- CodeChallenge,
39
- CodeVerifier,
40
- RedirectUri
41
- } from "../../chunk-GRVV7NLV.js";
43
+ } from "../chunk-V6WO67RO.js";
44
+
45
+ // src/shared/types/user.ts
46
+ var UserId = (value) => value;
47
+ var UserEmail = (value) => value;
48
+ var User = {
49
+ fromDto: (dto) => ({
50
+ id: UserId(dto.id),
51
+ email: UserEmail(dto.email)
52
+ })
53
+ };
42
54
  export {
55
+ Asset,
56
+ AssetCode,
57
+ AssetId,
43
58
  AuthorizationCode,
44
59
  Blockchain,
45
60
  ClientId,
@@ -51,6 +66,8 @@ export {
51
66
  FaqItem,
52
67
  Link,
53
68
  Milestone,
69
+ NotAuthenticatedError,
70
+ NotImplementedError,
54
71
  OAuthRefreshToken,
55
72
  OAuthSession,
56
73
  Offer,
@@ -66,12 +83,14 @@ export {
66
83
  ParticipationId,
67
84
  ParticipationsPaginationParams,
68
85
  RedirectUri,
86
+ Requirement,
87
+ RequirementId,
88
+ RequirementStatusInfo,
69
89
  TermItem,
70
90
  User,
71
91
  UserEmail,
72
92
  UserId,
73
93
  WalletAddress,
74
- createCoinListClient,
75
94
  fetchAllPages
76
95
  };
77
96
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/shared/types/user.ts"],"sourcesContent":["import type { UserDto } from '@/shared/types/dto/user';\nimport type { Newtype } from '@/shared/types/newtype';\n\nexport type UserId = Newtype<string, 'UserId'>;\nexport const UserId = (value: string) => value as UserId;\nexport type UserEmail = Newtype<string, 'UserEmail'>;\nexport const UserEmail = (value: string) => value as UserEmail;\n\nexport type User = {\n id: UserId;\n email: UserEmail;\n};\n\nexport const User = {\n fromDto: (dto: UserDto): User => ({\n id: UserId(dto.id),\n email: UserEmail(dto.email),\n }),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,IAAM,SAAS,CAAC,UAAkB;AAElC,IAAM,YAAY,CAAC,UAAkB;AAOrC,IAAM,OAAO;AAAA,EAClB,SAAS,CAAC,SAAwB;AAAA,IAChC,IAAI,OAAO,IAAI,EAAE;AAAA,IACjB,OAAO,UAAU,IAAI,KAAK;AAAA,EAC5B;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinlist-co/react",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "CoinList Partner SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/client/index.cjs",
@@ -12,31 +12,16 @@
12
12
  "import": "./dist/client/index.js",
13
13
  "require": "./dist/client/index.cjs"
14
14
  },
15
- "./client": {
16
- "types": "./dist/client/index.d.ts",
17
- "import": "./dist/client/index.js",
18
- "require": "./dist/client/index.cjs"
19
- },
20
- "./client/hooks": {
21
- "types": "./dist/client/hooks/index.d.ts",
22
- "import": "./dist/client/hooks/index.js",
23
- "require": "./dist/client/hooks/index.cjs"
24
- },
25
- "./client/components": {
26
- "types": "./dist/client/components/index.d.ts",
27
- "import": "./dist/client/components/index.js",
28
- "require": "./dist/client/components/index.cjs"
29
- },
30
- "./client/core": {
31
- "types": "./dist/client/core/index.d.ts",
32
- "import": "./dist/client/core/index.js",
33
- "require": "./dist/client/core/index.cjs"
34
- },
35
15
  "./server": {
36
16
  "types": "./dist/server/index.d.ts",
37
17
  "import": "./dist/server/index.js",
38
18
  "require": "./dist/server/index.cjs"
39
19
  },
20
+ "./shared": {
21
+ "types": "./dist/shared/index.d.ts",
22
+ "import": "./dist/shared/index.js",
23
+ "require": "./dist/shared/index.cjs"
24
+ },
40
25
  "./styles.css": "./dist/client/styles.css"
41
26
  },
42
27
  "files": [
@@ -52,7 +37,7 @@
52
37
  },
53
38
  "devDependencies": {
54
39
  "@biomejs/biome": "^2.4.4",
55
- "@ivy-apps/deslop": "^0.4.10",
40
+ "@ivy-apps/deslop": "^0.6.1",
56
41
  "@storybook/addon-docs": "^10.2.15",
57
42
  "@storybook/addon-themes": "^10.2.15",
58
43
  "@storybook/react": "^10.2.15",