@coinlist-co/react 0.5.1 → 0.9.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.
- package/dist/{chunk-5E3P7AMH.js → chunk-AAER5LOL.js} +3 -1
- package/dist/chunk-AAER5LOL.js.map +1 -0
- package/dist/chunk-I5YTJ5SL.js +644 -0
- package/dist/chunk-I5YTJ5SL.js.map +1 -0
- package/dist/{chunk-N3WBC2VS.js → chunk-MKCOK3DF.js} +68 -57
- package/dist/chunk-MKCOK3DF.js.map +1 -0
- package/dist/chunk-Z2HAA2TI.js +768 -0
- package/dist/chunk-Z2HAA2TI.js.map +1 -0
- package/dist/client/index.cjs +3360 -556
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +921 -18
- package/dist/client/index.d.ts +921 -18
- package/dist/client/index.js +2275 -392
- package/dist/client/index.js.map +1 -1
- package/dist/collections-B84Vw55t.d.cts +28 -0
- package/dist/collections-BQbFJS3g.d.ts +28 -0
- package/dist/requirement-C2w45Q11.d.cts +969 -0
- package/dist/requirement-C2w45Q11.d.ts +969 -0
- package/dist/server/index.cjs +521 -37
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +116 -9
- package/dist/server/index.d.ts +116 -9
- package/dist/server/index.js +95 -28
- package/dist/server/index.js.map +1 -1
- package/dist/shared/index.cjs +1264 -42
- package/dist/shared/index.cjs.map +1 -1
- package/dist/shared/index.d.cts +644 -3
- package/dist/shared/index.d.ts +644 -3
- package/dist/shared/index.js +220 -5
- package/dist/shared/index.js.map +1 -1
- package/package.json +33 -30
- package/dist/chunk-5E3P7AMH.js.map +0 -1
- package/dist/chunk-CRACFEJ4.js +0 -17
- package/dist/chunk-CRACFEJ4.js.map +0 -1
- package/dist/chunk-N3WBC2VS.js.map +0 -1
- package/dist/chunk-V6WO67RO.js +0 -311
- package/dist/chunk-V6WO67RO.js.map +0 -1
- package/dist/client/styles.css +0 -2
- package/dist/requirement-BEO42QOr.d.cts +0 -387
- package/dist/requirement-BEO42QOr.d.ts +0 -387
package/dist/shared/index.js
CHANGED
|
@@ -1,24 +1,78 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AssetIconUrl,
|
|
2
3
|
AuthorizationCode,
|
|
4
|
+
BPS_DENOM,
|
|
3
5
|
ClientId,
|
|
4
6
|
ClientSecret,
|
|
5
7
|
CodeChallenge,
|
|
6
8
|
CodeVerifier,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
DEFAULT_AMOUNT_TO_COMPUTE_PRICE,
|
|
10
|
+
DEFAULT_SLIPPAGE_BPS,
|
|
11
|
+
ERC20_ABI,
|
|
12
|
+
FormattedAmountAssetUi,
|
|
13
|
+
FormattedAmountUi,
|
|
14
|
+
FormattedPercentUi,
|
|
15
|
+
NA_AMOUNT_ASSET_UI,
|
|
16
|
+
PKCEState,
|
|
17
|
+
RedirectUri,
|
|
18
|
+
SLIPPAGE_OPTIONS_BPS,
|
|
19
|
+
SUPERSTATE_SWAP_ABI,
|
|
20
|
+
SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA,
|
|
21
|
+
SUPERSTATE_TOS_URL,
|
|
22
|
+
SWAP_POLL_INTERVAL_MS,
|
|
23
|
+
ShortenedWalletAddress,
|
|
24
|
+
SwapQuote,
|
|
25
|
+
TOKEN_REGISTRY,
|
|
26
|
+
TxExplorerUrl,
|
|
27
|
+
USDC,
|
|
28
|
+
USDC_SYMBOL,
|
|
29
|
+
USDT,
|
|
30
|
+
USDT_SYMBOL,
|
|
31
|
+
applyBps,
|
|
32
|
+
assetAmount,
|
|
33
|
+
computePrice,
|
|
34
|
+
computeSlip,
|
|
35
|
+
decodeSwappedOutputAmount,
|
|
36
|
+
formatAmount,
|
|
37
|
+
formatBpsAsPercent,
|
|
38
|
+
formatCompactAmount,
|
|
39
|
+
formatRawAmount,
|
|
40
|
+
formattedPricePerShare,
|
|
41
|
+
formattedUsdPrice,
|
|
42
|
+
generatePKCEParams,
|
|
43
|
+
isStopped,
|
|
44
|
+
shortenAddress,
|
|
45
|
+
usdAmount
|
|
46
|
+
} from "../chunk-I5YTJ5SL.js";
|
|
9
47
|
import {
|
|
48
|
+
ClientCredentialsOAuth,
|
|
10
49
|
OAuthRefreshToken,
|
|
11
50
|
OAuthSession
|
|
12
|
-
} from "../chunk-
|
|
51
|
+
} from "../chunk-AAER5LOL.js";
|
|
13
52
|
import {
|
|
53
|
+
AllowWalletResponse,
|
|
14
54
|
Asset,
|
|
15
55
|
AssetCode,
|
|
56
|
+
AssetDecimals,
|
|
16
57
|
AssetId,
|
|
58
|
+
AssetSymbol,
|
|
17
59
|
Blockchain,
|
|
60
|
+
BlockchainAmount,
|
|
61
|
+
Bps,
|
|
62
|
+
ConnectExternalWalletParams,
|
|
18
63
|
CreateParticipationParams,
|
|
64
|
+
CreateWalletOwnershipChallengeParams,
|
|
19
65
|
Cursor,
|
|
66
|
+
DocumentSubmission,
|
|
67
|
+
EvmContractAddress,
|
|
68
|
+
EvmWalletAddress,
|
|
20
69
|
FaqItem,
|
|
70
|
+
HexEncodedTransactionData,
|
|
71
|
+
Iso2CountryCode,
|
|
72
|
+
KnownAssetSymbol,
|
|
73
|
+
KycToken,
|
|
21
74
|
Link,
|
|
75
|
+
MAX_UINT_256,
|
|
22
76
|
Milestone,
|
|
23
77
|
NotAuthenticatedError,
|
|
24
78
|
NotImplementedError,
|
|
@@ -26,6 +80,8 @@ import {
|
|
|
26
80
|
OfferDetail,
|
|
27
81
|
OfferId,
|
|
28
82
|
OfferOption,
|
|
83
|
+
OfferOptionAddress,
|
|
84
|
+
OfferOptionAddressId,
|
|
29
85
|
OfferOptionId,
|
|
30
86
|
OfferOptionSlug,
|
|
31
87
|
OfferSlug,
|
|
@@ -34,13 +90,100 @@ import {
|
|
|
34
90
|
Participation,
|
|
35
91
|
ParticipationId,
|
|
36
92
|
ParticipationsPaginationParams,
|
|
93
|
+
Pii,
|
|
94
|
+
PiiAddress,
|
|
95
|
+
PiiJurisdiction,
|
|
37
96
|
Requirement,
|
|
38
97
|
RequirementId,
|
|
39
98
|
RequirementStatusInfo,
|
|
99
|
+
StablecoinSymbol,
|
|
100
|
+
SwapAuthorization,
|
|
101
|
+
SwapNamespaceImpl,
|
|
102
|
+
SwapPreview,
|
|
103
|
+
SwapStatus,
|
|
40
104
|
TermItem,
|
|
105
|
+
TokenAllowance,
|
|
106
|
+
TokenBalance,
|
|
41
107
|
WalletAddress,
|
|
108
|
+
WalletOwnershipChallenge,
|
|
109
|
+
assertUint256,
|
|
42
110
|
fetchAllPages
|
|
43
|
-
} from "../chunk-
|
|
111
|
+
} from "../chunk-Z2HAA2TI.js";
|
|
112
|
+
|
|
113
|
+
// src/shared/core/blockchain/chain.ts
|
|
114
|
+
function getChainId(chain) {
|
|
115
|
+
switch (chain) {
|
|
116
|
+
case "ethereum_mainnet":
|
|
117
|
+
return 1;
|
|
118
|
+
case "ethereum_sepolia":
|
|
119
|
+
return 11155111;
|
|
120
|
+
default: {
|
|
121
|
+
const _exhaustive = chain;
|
|
122
|
+
return _exhaustive;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function getNetworkName(chain) {
|
|
127
|
+
switch (chain) {
|
|
128
|
+
case "ethereum_mainnet":
|
|
129
|
+
return "Ethereum";
|
|
130
|
+
case "ethereum_sepolia":
|
|
131
|
+
return "Ethereum Sepolia";
|
|
132
|
+
default: {
|
|
133
|
+
const _exhaustive = chain;
|
|
134
|
+
return _exhaustive;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function txExplorerUrl(chain, txHash) {
|
|
139
|
+
return TxExplorerUrl(`${explorerBaseUrl(chain)}/tx/${txHash}`);
|
|
140
|
+
}
|
|
141
|
+
function explorerBaseUrl(chain) {
|
|
142
|
+
switch (chain) {
|
|
143
|
+
case "ethereum_mainnet":
|
|
144
|
+
return "https://etherscan.io";
|
|
145
|
+
case "ethereum_sepolia":
|
|
146
|
+
return "https://sepolia.etherscan.io";
|
|
147
|
+
default: {
|
|
148
|
+
const _exhaustive = chain;
|
|
149
|
+
return _exhaustive;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// src/shared/core/blockchain/math.ts
|
|
155
|
+
import { parseUnits } from "viem";
|
|
156
|
+
function parseBlockchainAmount(amount, decimals) {
|
|
157
|
+
const trimmed = amount.trim();
|
|
158
|
+
if (trimmed === "") return { valid: false, reason: { type: "empty" } };
|
|
159
|
+
if (trimmed.startsWith("-")) {
|
|
160
|
+
return { valid: false, reason: { type: "negative" } };
|
|
161
|
+
}
|
|
162
|
+
if (/[eE]/.test(trimmed)) {
|
|
163
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
164
|
+
}
|
|
165
|
+
if (!/^\d+(\.\d+)?$/.test(trimmed)) {
|
|
166
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
167
|
+
}
|
|
168
|
+
const [, fraction = ""] = trimmed.split(".");
|
|
169
|
+
if (fraction.length > decimals) {
|
|
170
|
+
return {
|
|
171
|
+
valid: false,
|
|
172
|
+
reason: { type: "too-many-decimals", maxDecimals: decimals }
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
try {
|
|
176
|
+
return {
|
|
177
|
+
valid: true,
|
|
178
|
+
amount: BlockchainAmount({
|
|
179
|
+
raw: parseUnits(trimmed, decimals),
|
|
180
|
+
decimals
|
|
181
|
+
})
|
|
182
|
+
};
|
|
183
|
+
} catch {
|
|
184
|
+
return { valid: false, reason: { type: "invalid-format" } };
|
|
185
|
+
}
|
|
186
|
+
}
|
|
44
187
|
|
|
45
188
|
// src/shared/types/user.ts
|
|
46
189
|
var UserId = (value) => value;
|
|
@@ -52,20 +195,45 @@ var User = {
|
|
|
52
195
|
})
|
|
53
196
|
};
|
|
54
197
|
export {
|
|
198
|
+
AllowWalletResponse,
|
|
55
199
|
Asset,
|
|
56
200
|
AssetCode,
|
|
201
|
+
AssetDecimals,
|
|
202
|
+
AssetIconUrl,
|
|
57
203
|
AssetId,
|
|
204
|
+
AssetSymbol,
|
|
58
205
|
AuthorizationCode,
|
|
206
|
+
BPS_DENOM,
|
|
59
207
|
Blockchain,
|
|
208
|
+
BlockchainAmount,
|
|
209
|
+
Bps,
|
|
210
|
+
ClientCredentialsOAuth,
|
|
60
211
|
ClientId,
|
|
61
212
|
ClientSecret,
|
|
62
213
|
CodeChallenge,
|
|
63
214
|
CodeVerifier,
|
|
215
|
+
ConnectExternalWalletParams,
|
|
64
216
|
CreateParticipationParams,
|
|
217
|
+
CreateWalletOwnershipChallengeParams,
|
|
65
218
|
Cursor,
|
|
219
|
+
DEFAULT_AMOUNT_TO_COMPUTE_PRICE,
|
|
220
|
+
DEFAULT_SLIPPAGE_BPS,
|
|
221
|
+
DocumentSubmission,
|
|
222
|
+
ERC20_ABI,
|
|
223
|
+
EvmContractAddress,
|
|
224
|
+
EvmWalletAddress,
|
|
66
225
|
FaqItem,
|
|
226
|
+
FormattedAmountAssetUi,
|
|
227
|
+
FormattedAmountUi,
|
|
228
|
+
FormattedPercentUi,
|
|
229
|
+
HexEncodedTransactionData,
|
|
230
|
+
Iso2CountryCode,
|
|
231
|
+
KnownAssetSymbol,
|
|
232
|
+
KycToken,
|
|
67
233
|
Link,
|
|
234
|
+
MAX_UINT_256,
|
|
68
235
|
Milestone,
|
|
236
|
+
NA_AMOUNT_ASSET_UI,
|
|
69
237
|
NotAuthenticatedError,
|
|
70
238
|
NotImplementedError,
|
|
71
239
|
OAuthRefreshToken,
|
|
@@ -74,23 +242,70 @@ export {
|
|
|
74
242
|
OfferDetail,
|
|
75
243
|
OfferId,
|
|
76
244
|
OfferOption,
|
|
245
|
+
OfferOptionAddress,
|
|
246
|
+
OfferOptionAddressId,
|
|
77
247
|
OfferOptionId,
|
|
78
248
|
OfferOptionSlug,
|
|
79
249
|
OfferSlug,
|
|
250
|
+
PKCEState,
|
|
80
251
|
PaginatedResponse,
|
|
81
252
|
PaginationParams,
|
|
82
253
|
Participation,
|
|
83
254
|
ParticipationId,
|
|
84
255
|
ParticipationsPaginationParams,
|
|
256
|
+
Pii,
|
|
257
|
+
PiiAddress,
|
|
258
|
+
PiiJurisdiction,
|
|
85
259
|
RedirectUri,
|
|
86
260
|
Requirement,
|
|
87
261
|
RequirementId,
|
|
88
262
|
RequirementStatusInfo,
|
|
263
|
+
SLIPPAGE_OPTIONS_BPS,
|
|
264
|
+
SUPERSTATE_SWAP_ABI,
|
|
265
|
+
SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA,
|
|
266
|
+
SUPERSTATE_TOS_URL,
|
|
267
|
+
SWAP_POLL_INTERVAL_MS,
|
|
268
|
+
ShortenedWalletAddress,
|
|
269
|
+
StablecoinSymbol,
|
|
270
|
+
SwapAuthorization,
|
|
271
|
+
SwapNamespaceImpl,
|
|
272
|
+
SwapPreview,
|
|
273
|
+
SwapQuote,
|
|
274
|
+
SwapStatus,
|
|
275
|
+
TOKEN_REGISTRY,
|
|
89
276
|
TermItem,
|
|
277
|
+
TokenAllowance,
|
|
278
|
+
TokenBalance,
|
|
279
|
+
TxExplorerUrl,
|
|
280
|
+
USDC,
|
|
281
|
+
USDC_SYMBOL,
|
|
282
|
+
USDT,
|
|
283
|
+
USDT_SYMBOL,
|
|
90
284
|
User,
|
|
91
285
|
UserEmail,
|
|
92
286
|
UserId,
|
|
93
287
|
WalletAddress,
|
|
94
|
-
|
|
288
|
+
WalletOwnershipChallenge,
|
|
289
|
+
applyBps,
|
|
290
|
+
assertUint256,
|
|
291
|
+
assetAmount,
|
|
292
|
+
computePrice,
|
|
293
|
+
computeSlip,
|
|
294
|
+
decodeSwappedOutputAmount,
|
|
295
|
+
fetchAllPages,
|
|
296
|
+
formatAmount,
|
|
297
|
+
formatBpsAsPercent,
|
|
298
|
+
formatCompactAmount,
|
|
299
|
+
formatRawAmount,
|
|
300
|
+
formattedPricePerShare,
|
|
301
|
+
formattedUsdPrice,
|
|
302
|
+
generatePKCEParams,
|
|
303
|
+
getChainId,
|
|
304
|
+
getNetworkName,
|
|
305
|
+
isStopped,
|
|
306
|
+
parseBlockchainAmount,
|
|
307
|
+
shortenAddress,
|
|
308
|
+
txExplorerUrl,
|
|
309
|
+
usdAmount
|
|
95
310
|
};
|
|
96
311
|
//# sourceMappingURL=index.js.map
|
package/dist/shared/index.js.map
CHANGED
|
@@ -1 +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":"
|
|
1
|
+
{"version":3,"sources":["../../src/shared/core/blockchain/chain.ts","../../src/shared/core/blockchain/math.ts","../../src/shared/types/user.ts"],"sourcesContent":["import type { Hash } from 'viem';\nimport type { EthereumChain } from '@/shared/types/blockchain/core';\nimport { TxExplorerUrl } from '@/shared/types/blockchain/ui';\n\nexport function getChainId(chain: EthereumChain): number {\n switch (chain) {\n case 'ethereum_mainnet':\n return 1;\n case 'ethereum_sepolia':\n return 11155111;\n default: {\n const _exhaustive: never = chain;\n return _exhaustive;\n }\n }\n}\n\nexport function getNetworkName(chain: EthereumChain): string {\n switch (chain) {\n case 'ethereum_mainnet':\n return 'Ethereum';\n case 'ethereum_sepolia':\n return 'Ethereum Sepolia';\n default: {\n const _exhaustive: never = chain;\n return _exhaustive;\n }\n }\n}\n\nexport function txExplorerUrl(\n chain: EthereumChain,\n txHash: Hash\n): TxExplorerUrl {\n return TxExplorerUrl(`${explorerBaseUrl(chain)}/tx/${txHash}`);\n}\n\nfunction explorerBaseUrl(chain: EthereumChain): string {\n switch (chain) {\n case 'ethereum_mainnet':\n return 'https://etherscan.io';\n case 'ethereum_sepolia':\n return 'https://sepolia.etherscan.io';\n default: {\n const _exhaustive: never = chain;\n return _exhaustive;\n }\n }\n}\n","import { parseUnits } from 'viem';\nimport {\n type AssetDecimals,\n BlockchainAmount,\n} from '@/shared/types/blockchain/core';\n\n/** A typed, i18n-agnostic reason a raw amount string failed to parse. */\nexport type AmountParseErrorReason =\n | { type: 'empty' }\n | { type: 'negative' }\n | { type: 'invalid-format' }\n | { type: 'too-many-decimals'; maxDecimals: AssetDecimals };\n\nexport type AmountParseResult =\n | { valid: true; amount: BlockchainAmount }\n | { valid: false; reason: AmountParseErrorReason };\n\n/**\n * Parses a user-entered decimal string into a {@link BlockchainAmount} at the\n * given token decimals. Rejects scientific notation, negatives, malformed\n * input, and more fractional digits than the token supports — surfacing a\n * typed {@link AmountParseErrorReason} so callers own the display copy.\n */\nexport function parseBlockchainAmount(\n amount: string,\n decimals: AssetDecimals\n): AmountParseResult {\n const trimmed = amount.trim();\n if (trimmed === '') return { valid: false, reason: { type: 'empty' } };\n if (trimmed.startsWith('-')) {\n return { valid: false, reason: { type: 'negative' } };\n }\n // viem accepts \"1e18\" as scientific notation — reject it explicitly\n if (/[eE]/.test(trimmed)) {\n return { valid: false, reason: { type: 'invalid-format' } };\n }\n // reject bare decimal point or missing digits on either side\n if (!/^\\d+(\\.\\d+)?$/.test(trimmed)) {\n return { valid: false, reason: { type: 'invalid-format' } };\n }\n const [, fraction = ''] = trimmed.split('.');\n if (fraction.length > decimals) {\n return {\n valid: false,\n reason: { type: 'too-many-decimals', maxDecimals: decimals },\n };\n }\n try {\n return {\n valid: true,\n amount: BlockchainAmount({\n raw: parseUnits(trimmed, decimals),\n decimals,\n }),\n };\n } catch {\n return { valid: false, reason: { type: 'invalid-format' } };\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 email: UserEmail(dto.email),\n }),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAAS,WAAW,OAA8B;AACvD,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,SAAS;AACP,YAAM,cAAqB;AAC3B,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEO,SAAS,eAAe,OAA8B;AAC3D,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,SAAS;AACP,YAAM,cAAqB;AAC3B,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEO,SAAS,cACd,OACA,QACe;AACf,SAAO,cAAc,GAAG,gBAAgB,KAAK,CAAC,OAAO,MAAM,EAAE;AAC/D;AAEA,SAAS,gBAAgB,OAA8B;AACrD,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,SAAS;AACP,YAAM,cAAqB;AAC3B,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;AChDA,SAAS,kBAAkB;AAuBpB,SAAS,sBACd,QACA,UACmB;AACnB,QAAM,UAAU,OAAO,KAAK;AAC5B,MAAI,YAAY,GAAI,QAAO,EAAE,OAAO,OAAO,QAAQ,EAAE,MAAM,QAAQ,EAAE;AACrE,MAAI,QAAQ,WAAW,GAAG,GAAG;AAC3B,WAAO,EAAE,OAAO,OAAO,QAAQ,EAAE,MAAM,WAAW,EAAE;AAAA,EACtD;AAEA,MAAI,OAAO,KAAK,OAAO,GAAG;AACxB,WAAO,EAAE,OAAO,OAAO,QAAQ,EAAE,MAAM,iBAAiB,EAAE;AAAA,EAC5D;AAEA,MAAI,CAAC,gBAAgB,KAAK,OAAO,GAAG;AAClC,WAAO,EAAE,OAAO,OAAO,QAAQ,EAAE,MAAM,iBAAiB,EAAE;AAAA,EAC5D;AACA,QAAM,CAAC,EAAE,WAAW,EAAE,IAAI,QAAQ,MAAM,GAAG;AAC3C,MAAI,SAAS,SAAS,UAAU;AAC9B,WAAO;AAAA,MACL,OAAO;AAAA,MACP,QAAQ,EAAE,MAAM,qBAAqB,aAAa,SAAS;AAAA,IAC7D;AAAA,EACF;AACA,MAAI;AACF,WAAO;AAAA,MACL,OAAO;AAAA,MACP,QAAQ,iBAAiB;AAAA,QACvB,KAAK,WAAW,SAAS,QAAQ;AAAA,QACjC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,QAAQ;AACN,WAAO,EAAE,OAAO,OAAO,QAAQ,EAAE,MAAM,iBAAiB,EAAE;AAAA,EAC5D;AACF;;;ACtDO,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,8 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinlist-co/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "CoinList Partner SDK",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"prepare": "npm run build:css",
|
|
8
|
+
"build": "npm run build:css && npm run build:js",
|
|
9
|
+
"build:css": "node ./scripts/build-css.mjs",
|
|
10
|
+
"build:js": "tsup",
|
|
11
|
+
"clean:tarballs": "rm -f ./coinlist-react-*.tgz ./coinlist-co-react-*.tgz",
|
|
12
|
+
"pack": "npm run clean:tarballs && npm run build && npm pack",
|
|
13
|
+
"dev": "tsup --watch",
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"test:ci": "vitest run --coverage",
|
|
16
|
+
"test:e2e": "E2E=1 vitest run -c vitest.e2e.config.ts",
|
|
17
|
+
"test:e2e:browser": "vitest run -c vitest.e2e.browser.config.ts",
|
|
18
|
+
"test:watch": "vitest",
|
|
19
|
+
"storybook": "npm run build:css && storybook dev -p 6006",
|
|
20
|
+
"storybook:build": "npm run build:css && storybook build",
|
|
21
|
+
"typecheck": "tsc --noEmit",
|
|
22
|
+
"biome:check": "biome check .",
|
|
23
|
+
"deslop": "deslop --check",
|
|
24
|
+
"lint": "npm run biome:check && npm run deslop",
|
|
25
|
+
"lint:fix": "deslop && biome check . --write --unsafe",
|
|
26
|
+
"check": "npm run typecheck && npm run lint && npm run build && npm run storybook:build && npm run test && npm run test:e2e && npm run test:e2e:browser",
|
|
27
|
+
"fix": "npm run lint:fix"
|
|
28
|
+
},
|
|
6
29
|
"main": "./dist/client/index.cjs",
|
|
7
30
|
"module": "./dist/client/index.js",
|
|
8
31
|
"types": "./dist/client/index.d.ts",
|
|
@@ -21,19 +44,17 @@
|
|
|
21
44
|
"types": "./dist/shared/index.d.ts",
|
|
22
45
|
"import": "./dist/shared/index.js",
|
|
23
46
|
"require": "./dist/shared/index.cjs"
|
|
24
|
-
}
|
|
25
|
-
"./styles.css": "./dist/client/styles.css"
|
|
47
|
+
}
|
|
26
48
|
},
|
|
27
49
|
"files": [
|
|
28
50
|
"dist",
|
|
29
51
|
"README.MD"
|
|
30
52
|
],
|
|
31
|
-
"sideEffects":
|
|
32
|
-
"**/*.css"
|
|
33
|
-
],
|
|
53
|
+
"sideEffects": false,
|
|
34
54
|
"peerDependencies": {
|
|
35
55
|
"react": ">=18.0.0",
|
|
36
|
-
"react-dom": ">=18.0.0"
|
|
56
|
+
"react-dom": ">=18.0.0",
|
|
57
|
+
"viem": "^2.0.0"
|
|
37
58
|
},
|
|
38
59
|
"devDependencies": {
|
|
39
60
|
"@biomejs/biome": "^2.4.4",
|
|
@@ -54,7 +75,7 @@
|
|
|
54
75
|
"@vitest/coverage-v8": "^4.0.18",
|
|
55
76
|
"jsdom": "^25.0.1",
|
|
56
77
|
"msw": "^2.12.10",
|
|
57
|
-
"playwright": "
|
|
78
|
+
"playwright": "1.61.1",
|
|
58
79
|
"react": "^19.0.0",
|
|
59
80
|
"react-dom": "^19.0.0",
|
|
60
81
|
"storybook": "^10.2.15",
|
|
@@ -62,30 +83,10 @@
|
|
|
62
83
|
"tslib": "^2.8.1",
|
|
63
84
|
"tsup": "^8.5.1",
|
|
64
85
|
"typescript": "^5.9.3",
|
|
65
|
-
"
|
|
86
|
+
"viem": "^2.55.1",
|
|
87
|
+
"vite": "^7.3.6",
|
|
66
88
|
"vitest": "^4.0.18"
|
|
67
89
|
},
|
|
68
|
-
"scripts": {
|
|
69
|
-
"build": "npm run build:css && npm run build:js",
|
|
70
|
-
"build:css": "node ./scripts/build-css.mjs",
|
|
71
|
-
"build:js": "tsup && node ./scripts/copy-css.mjs",
|
|
72
|
-
"clean:tarballs": "rm -f ./coinlist-react-*.tgz ./coinlist-co-react-*.tgz",
|
|
73
|
-
"pack": "npm run clean:tarballs && npm run build && npm pack",
|
|
74
|
-
"dev": "tsup --watch",
|
|
75
|
-
"test": "vitest run",
|
|
76
|
-
"test:ci": "vitest run --coverage",
|
|
77
|
-
"test:e2e": "E2E=1 vitest run -c vitest.e2e.config.ts",
|
|
78
|
-
"test:e2e:browser": "vitest run -c vitest.e2e.browser.config.ts",
|
|
79
|
-
"test:watch": "vitest",
|
|
80
|
-
"storybook": "storybook dev -p 6006",
|
|
81
|
-
"storybook:build": "storybook build",
|
|
82
|
-
"typecheck": "tsc --noEmit",
|
|
83
|
-
"biome:check": "biome check .",
|
|
84
|
-
"deslop": "deslop --check",
|
|
85
|
-
"lint": "npm run biome:check && npm run deslop",
|
|
86
|
-
"lint:fix": "deslop && biome check . --write --unsafe",
|
|
87
|
-
"check": "npm run typecheck && npm run lint && npm run build && npm run storybook:build && npm run test && npm run test:e2e && npm run test:e2e:browser"
|
|
88
|
-
},
|
|
89
90
|
"repository": {
|
|
90
91
|
"type": "git",
|
|
91
92
|
"url": "git+https://github.com/coinlist/coinlist-frontend-sdk.git"
|
|
@@ -100,6 +101,8 @@
|
|
|
100
101
|
"license": "ISC",
|
|
101
102
|
"homepage": "https://docs.coinlist.co/",
|
|
102
103
|
"dependencies": {
|
|
104
|
+
"@sumsub/websdk": "^2.6.3",
|
|
105
|
+
"@sumsub/websdk-react": "^2.6.3",
|
|
103
106
|
"class-variance-authority": "^0.7.1",
|
|
104
107
|
"clsx": "^2.1.1",
|
|
105
108
|
"lucide-react": "^0.577.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shared/types/oauth-session.ts"],"sourcesContent":["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"],"mappings":";AASO,IAAM,oBAAoB,CAAC,UAAkB;AAO7C,IAAM,eAAe;AAAA,EAC1B,SAAS,CAAC,QAAuC;AAC/C,UAAM,YAAY,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,aAAa,GAAI;AAC7D,WAAO;AAAA,MACL,aAAa;AAAA,QACX,OAAO,IAAI;AAAA,QACX;AAAA,MACF;AAAA,MACA,GAAI,IAAI,iBAAiB,QAAQ,IAAI,kBAAkB,KACnD,EAAE,cAAc,kBAAkB,IAAI,aAAa,EAAE,IACrD;AAAA,IACN;AAAA,EACF;AACF;","names":[]}
|
package/dist/chunk-CRACFEJ4.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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,oBAAoB;AAC1B,IAAM,kBAAkB;AAExB,IAAM,yBACX;AAEK,IAAM,uBAAuB;AAC7B,IAAM,gCACX;AACK,IAAM,wCACX;AACK,IAAM,uCACX;AACK,IAAM,qCACX;AACK,IAAM,cAAc;;;ACV3B,IAAM,QAAoB,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