@coinlist-co/react 0.4.0 → 0.5.1
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-CRACFEJ4.js +17 -0
- package/dist/chunk-CRACFEJ4.js.map +1 -0
- package/dist/{chunk-NC45IO63.js → chunk-N3WBC2VS.js} +20 -325
- package/dist/chunk-N3WBC2VS.js.map +1 -0
- package/dist/chunk-V6WO67RO.js +311 -0
- package/dist/chunk-V6WO67RO.js.map +1 -0
- package/dist/client/index.cjs +1013 -220
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +526 -9
- package/dist/client/index.d.ts +526 -9
- package/dist/client/index.js +1464 -94
- package/dist/client/index.js.map +1 -1
- package/dist/{participation-DMMEDxON.d.cts → requirement-BEO42QOr.d.cts} +204 -2
- package/dist/{participation-E-bT-GXJ.d.ts → requirement-BEO42QOr.d.ts} +204 -2
- package/dist/server/index.cjs +50 -100
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +67 -24
- package/dist/server/index.d.ts +67 -24
- package/dist/server/index.js +54 -87
- package/dist/server/index.js.map +1 -1
- package/dist/shared/index.cjs +375 -0
- package/dist/shared/index.cjs.map +1 -0
- package/dist/shared/index.d.cts +35 -0
- package/dist/shared/index.d.ts +35 -0
- package/dist/{client/core → shared}/index.js +35 -16
- package/dist/shared/index.js.map +1 -0
- package/package.json +7 -22
- package/dist/RequirementItem-B-MvcxSr.d.cts +0 -37
- package/dist/RequirementItem-DcYot2uC.d.ts +0 -37
- package/dist/chunk-EHZ6PIGN.js +0 -414
- package/dist/chunk-EHZ6PIGN.js.map +0 -1
- package/dist/chunk-NC45IO63.js.map +0 -1
- package/dist/chunk-RIFATQB5.js +0 -257
- package/dist/chunk-RIFATQB5.js.map +0 -1
- package/dist/chunk-UGJUTRXC.js +0 -304
- package/dist/chunk-UGJUTRXC.js.map +0 -1
- package/dist/chunk-YJQMJFA7.js +0 -16
- package/dist/chunk-YJQMJFA7.js.map +0 -1
- package/dist/client/components/index.cjs +0 -1108
- package/dist/client/components/index.cjs.map +0 -1
- package/dist/client/components/index.d.cts +0 -139
- package/dist/client/components/index.d.ts +0 -139
- package/dist/client/components/index.js +0 -558
- package/dist/client/components/index.js.map +0 -1
- package/dist/client/core/index.cjs +0 -1047
- package/dist/client/core/index.cjs.map +0 -1
- package/dist/client/core/index.d.cts +0 -23
- package/dist/client/core/index.d.ts +0 -23
- package/dist/client/core/index.js.map +0 -1
- package/dist/client/hooks/index.cjs +0 -307
- package/dist/client/hooks/index.cjs.map +0 -1
- package/dist/client/hooks/index.d.cts +0 -126
- package/dist/client/hooks/index.d.ts +0 -126
- package/dist/client/hooks/index.js +0 -19
- package/dist/client/hooks/index.js.map +0 -1
- package/dist/coinlist-client-BSxpqylo.d.ts +0 -158
- package/dist/coinlist-client-Cah5c_aF.d.cts +0 -158
- package/dist/requirement-XWT0T_zO.d.cts +0 -205
- package/dist/requirement-XWT0T_zO.d.ts +0 -205
- package/dist/useCoinListRequirements-B5-ZPOMz.d.ts +0 -80
- package/dist/useCoinListRequirements-Cuc32Tqw.d.cts +0 -80
package/dist/chunk-UGJUTRXC.js
DELETED
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createCoinListClient
|
|
3
|
-
} from "./chunk-RIFATQB5.js";
|
|
4
|
-
import {
|
|
5
|
-
NotAuthenticatedError
|
|
6
|
-
} from "./chunk-NC45IO63.js";
|
|
7
|
-
|
|
8
|
-
// src/client/hooks/useCoinList.ts
|
|
9
|
-
import { useContext } from "react";
|
|
10
|
-
|
|
11
|
-
// src/client/CoinListProvider.tsx
|
|
12
|
-
import {
|
|
13
|
-
createContext,
|
|
14
|
-
useEffect,
|
|
15
|
-
useMemo,
|
|
16
|
-
useState
|
|
17
|
-
} from "react";
|
|
18
|
-
import { jsx } from "react/jsx-runtime";
|
|
19
|
-
var CoinListContext = createContext(null);
|
|
20
|
-
function CoinListProvider({ config, children }) {
|
|
21
|
-
const [isReady, setIsReady] = useState(false);
|
|
22
|
-
const coinlist = useMemo(() => createCoinListClient(config), [config]);
|
|
23
|
-
useEffect(() => {
|
|
24
|
-
let isCancelled = false;
|
|
25
|
-
if (coinlist.getAuthState() === "unknown") {
|
|
26
|
-
coinlist.init().then(() => {
|
|
27
|
-
if (!isCancelled) {
|
|
28
|
-
setIsReady(true);
|
|
29
|
-
}
|
|
30
|
-
}).catch(() => {
|
|
31
|
-
if (!isCancelled) {
|
|
32
|
-
setIsReady(true);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
} else {
|
|
36
|
-
setIsReady(true);
|
|
37
|
-
}
|
|
38
|
-
return () => {
|
|
39
|
-
isCancelled = true;
|
|
40
|
-
};
|
|
41
|
-
}, [coinlist]);
|
|
42
|
-
const value = useMemo(() => ({ coinlist, isReady }), [coinlist, isReady]);
|
|
43
|
-
return /* @__PURE__ */ jsx(CoinListContext.Provider, { value, children });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// src/client/hooks/useCoinList.ts
|
|
47
|
-
function useCoinList() {
|
|
48
|
-
const context = useContext(CoinListContext);
|
|
49
|
-
if (context === null) {
|
|
50
|
-
throw new CoinListClientInitializationError();
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
isReady: context.isReady,
|
|
54
|
-
coinlist: context.coinlist
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
var CoinListClientInitializationError = class extends Error {
|
|
58
|
-
constructor(message = "useCoinList() must be used within CoinListProvider. Wrap your app with <CoinListProvider config={...}>.") {
|
|
59
|
-
super(message);
|
|
60
|
-
this.name = "CoinListClientInitializationError";
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// src/client/hooks/useCoinListOfferDetails.ts
|
|
65
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
66
|
-
var LOADING_STATE = { type: "LOADING" };
|
|
67
|
-
function useCoinListOfferDetails(offerId, options = {}) {
|
|
68
|
-
const { coinlist, isReady } = useCoinList();
|
|
69
|
-
const { serverData } = options;
|
|
70
|
-
const [offerDetailsState, setOfferDetailsState] = useState2(
|
|
71
|
-
serverData !== void 0 ? { type: "CONTENT", offerDetail: serverData } : LOADING_STATE
|
|
72
|
-
);
|
|
73
|
-
useEffect2(() => {
|
|
74
|
-
let isCancelled = false;
|
|
75
|
-
if (!isReady) {
|
|
76
|
-
if (serverData === void 0) {
|
|
77
|
-
setOfferDetailsState(LOADING_STATE);
|
|
78
|
-
}
|
|
79
|
-
return () => {
|
|
80
|
-
isCancelled = true;
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
if (serverData !== void 0) {
|
|
84
|
-
return () => {
|
|
85
|
-
isCancelled = true;
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
setOfferDetailsState(LOADING_STATE);
|
|
89
|
-
coinlist.fetchOfferDetails(offerId).then((offerDetail) => {
|
|
90
|
-
if (!isCancelled) {
|
|
91
|
-
setOfferDetailsState({ type: "CONTENT", offerDetail });
|
|
92
|
-
}
|
|
93
|
-
}).catch((error) => {
|
|
94
|
-
if (!isCancelled) {
|
|
95
|
-
const reason = error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
|
|
96
|
-
setOfferDetailsState({ type: "ERROR", reason });
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
return () => {
|
|
100
|
-
isCancelled = true;
|
|
101
|
-
};
|
|
102
|
-
}, [coinlist, isReady, offerId, serverData]);
|
|
103
|
-
return { offerDetailsState };
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// src/client/hooks/useCoinListOffers.ts
|
|
107
|
-
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
108
|
-
var LOADING_STATE2 = { type: "LOADING" };
|
|
109
|
-
function useCoinListOffers(options = {}) {
|
|
110
|
-
const { coinlist, isReady } = useCoinList();
|
|
111
|
-
const { serverOffers } = options;
|
|
112
|
-
const [offersState, setOffersState] = useState3(
|
|
113
|
-
serverOffers !== void 0 ? { type: "CONTENT", offers: serverOffers } : LOADING_STATE2
|
|
114
|
-
);
|
|
115
|
-
useEffect3(() => {
|
|
116
|
-
let isCancelled = false;
|
|
117
|
-
if (!isReady) {
|
|
118
|
-
if (serverOffers === void 0) {
|
|
119
|
-
setOffersState(LOADING_STATE2);
|
|
120
|
-
}
|
|
121
|
-
return () => {
|
|
122
|
-
isCancelled = true;
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
if (serverOffers !== void 0) {
|
|
126
|
-
return () => {
|
|
127
|
-
isCancelled = true;
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
setOffersState(LOADING_STATE2);
|
|
131
|
-
coinlist.fetchAllOffers().then((offers) => {
|
|
132
|
-
if (!isCancelled) {
|
|
133
|
-
setOffersState({ type: "CONTENT", offers });
|
|
134
|
-
}
|
|
135
|
-
}).catch((error) => {
|
|
136
|
-
if (!isCancelled) {
|
|
137
|
-
const reason = error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
|
|
138
|
-
setOffersState({ type: "ERROR", reason });
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
return () => {
|
|
142
|
-
isCancelled = true;
|
|
143
|
-
};
|
|
144
|
-
}, [coinlist, isReady, serverOffers]);
|
|
145
|
-
return { offersState };
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// src/client/hooks/useCoinListRequirements.ts
|
|
149
|
-
import { useCallback, useEffect as useEffect4, useState as useState4 } from "react";
|
|
150
|
-
var LOADING_STATE3 = { type: "LOADING" };
|
|
151
|
-
function useCoinListRequirements(offerId, options = {}) {
|
|
152
|
-
const { coinlist, isReady } = useCoinList();
|
|
153
|
-
const { serverData } = options;
|
|
154
|
-
const [requirementsState, setRequirementsState] = useState4(
|
|
155
|
-
serverData !== void 0 ? { type: "CONTENT", ...serverData } : LOADING_STATE3
|
|
156
|
-
);
|
|
157
|
-
const [fetchKey, setFetchKey] = useState4(0);
|
|
158
|
-
const refetch = useCallback(() => setFetchKey((k) => k + 1), []);
|
|
159
|
-
useEffect4(() => {
|
|
160
|
-
let isCancelled = false;
|
|
161
|
-
if (!isReady) {
|
|
162
|
-
if (serverData === void 0) {
|
|
163
|
-
setRequirementsState(LOADING_STATE3);
|
|
164
|
-
}
|
|
165
|
-
return () => {
|
|
166
|
-
isCancelled = true;
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
if (serverData !== void 0 && fetchKey === 0) {
|
|
170
|
-
return () => {
|
|
171
|
-
isCancelled = true;
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
setRequirementsState(LOADING_STATE3);
|
|
175
|
-
Promise.all([
|
|
176
|
-
coinlist.fetchOfferRequirements(offerId),
|
|
177
|
-
coinlist.fetchRequirementStatuses(offerId)
|
|
178
|
-
]).then(([requirementsByOptionId, statuses]) => {
|
|
179
|
-
if (!isCancelled) {
|
|
180
|
-
setRequirementsState({
|
|
181
|
-
type: "CONTENT",
|
|
182
|
-
requirementsByOptionId,
|
|
183
|
-
statuses
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
}).catch((error) => {
|
|
187
|
-
if (!isCancelled) {
|
|
188
|
-
const reason = error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
|
|
189
|
-
setRequirementsState({ type: "ERROR", reason });
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
return () => {
|
|
193
|
-
isCancelled = true;
|
|
194
|
-
};
|
|
195
|
-
}, [coinlist, isReady, offerId, fetchKey]);
|
|
196
|
-
return { requirementsState, refetch };
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// src/client/hooks/useCompleteCoinListOAuth.ts
|
|
200
|
-
import { useEffect as useEffect5, useRef } from "react";
|
|
201
|
-
function useCompleteCoinListOAuth(options) {
|
|
202
|
-
const { coinlist } = useCoinList();
|
|
203
|
-
const postOAuthCompleteRef = useRef(options.postOAuthComplete);
|
|
204
|
-
const onFailureRef = useRef(options.onFailure);
|
|
205
|
-
const onSuccessRef = useRef(options.onSuccess);
|
|
206
|
-
postOAuthCompleteRef.current = options.postOAuthComplete;
|
|
207
|
-
onFailureRef.current = options.onFailure;
|
|
208
|
-
onSuccessRef.current = options.onSuccess;
|
|
209
|
-
const hasStartedExchangeRef = useRef(false);
|
|
210
|
-
useEffect5(() => {
|
|
211
|
-
if (typeof window === "undefined") return;
|
|
212
|
-
const params = new URLSearchParams(window.location.search);
|
|
213
|
-
if (!params.has("code") && !params.has("error")) return;
|
|
214
|
-
if (hasStartedExchangeRef.current) return;
|
|
215
|
-
const oauthResult = coinlist.completeOAuth();
|
|
216
|
-
if (oauthResult.type === "error") {
|
|
217
|
-
void Promise.resolve(onFailureRef.current(oauthResult.reason)).catch(
|
|
218
|
-
() => {
|
|
219
|
-
}
|
|
220
|
-
);
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
hasStartedExchangeRef.current = true;
|
|
224
|
-
let cancelled = false;
|
|
225
|
-
void (async () => {
|
|
226
|
-
try {
|
|
227
|
-
const ok = await postOAuthCompleteRef.current({
|
|
228
|
-
code: oauthResult.code,
|
|
229
|
-
codeVerifier: oauthResult.codeVerifier
|
|
230
|
-
});
|
|
231
|
-
if (cancelled) return;
|
|
232
|
-
if (!ok) {
|
|
233
|
-
hasStartedExchangeRef.current = false;
|
|
234
|
-
await onFailureRef.current("complete_request_failed");
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
await coinlist.init();
|
|
238
|
-
if (cancelled) return;
|
|
239
|
-
await onSuccessRef.current();
|
|
240
|
-
} catch {
|
|
241
|
-
if (cancelled) return;
|
|
242
|
-
hasStartedExchangeRef.current = false;
|
|
243
|
-
await onFailureRef.current("complete_request_failed");
|
|
244
|
-
}
|
|
245
|
-
})();
|
|
246
|
-
return () => {
|
|
247
|
-
cancelled = true;
|
|
248
|
-
hasStartedExchangeRef.current = false;
|
|
249
|
-
};
|
|
250
|
-
}, [coinlist]);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// src/client/hooks/useParticipations.ts
|
|
254
|
-
import { useEffect as useEffect6, useState as useState5 } from "react";
|
|
255
|
-
var LOADING_STATE4 = { type: "LOADING" };
|
|
256
|
-
function useParticipations(offerId, options = {}) {
|
|
257
|
-
const { coinlist, isReady } = useCoinList();
|
|
258
|
-
const { serverData } = options;
|
|
259
|
-
const [participationsState, setParticipationsState] = useState5(
|
|
260
|
-
serverData !== void 0 ? { type: "CONTENT", participations: serverData } : LOADING_STATE4
|
|
261
|
-
);
|
|
262
|
-
useEffect6(() => {
|
|
263
|
-
let isCancelled = false;
|
|
264
|
-
if (!isReady) {
|
|
265
|
-
if (serverData === void 0) {
|
|
266
|
-
setParticipationsState(LOADING_STATE4);
|
|
267
|
-
}
|
|
268
|
-
return () => {
|
|
269
|
-
isCancelled = true;
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
if (serverData !== void 0) {
|
|
273
|
-
return () => {
|
|
274
|
-
isCancelled = true;
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
setParticipationsState(LOADING_STATE4);
|
|
278
|
-
coinlist.fetchAllParticipations(offerId).then((participations) => {
|
|
279
|
-
if (!isCancelled) {
|
|
280
|
-
setParticipationsState({ type: "CONTENT", participations });
|
|
281
|
-
}
|
|
282
|
-
}).catch((error) => {
|
|
283
|
-
if (!isCancelled) {
|
|
284
|
-
const reason = error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
|
|
285
|
-
setParticipationsState({ type: "ERROR", reason });
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
return () => {
|
|
289
|
-
isCancelled = true;
|
|
290
|
-
};
|
|
291
|
-
}, [coinlist, isReady, offerId, serverData]);
|
|
292
|
-
return { participationsState };
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
export {
|
|
296
|
-
CoinListProvider,
|
|
297
|
-
useCoinList,
|
|
298
|
-
useCoinListOfferDetails,
|
|
299
|
-
useCoinListOffers,
|
|
300
|
-
useCoinListRequirements,
|
|
301
|
-
useCompleteCoinListOAuth,
|
|
302
|
-
useParticipations
|
|
303
|
-
};
|
|
304
|
-
//# sourceMappingURL=chunk-UGJUTRXC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client/hooks/useCoinList.ts","../src/client/CoinListProvider.tsx","../src/client/hooks/useCoinListOfferDetails.ts","../src/client/hooks/useCoinListOffers.ts","../src/client/hooks/useCoinListRequirements.ts","../src/client/hooks/useCompleteCoinListOAuth.ts","../src/client/hooks/useParticipations.ts"],"sourcesContent":["import { useContext } from 'react';\nimport { CoinListContext } from '@/client/CoinListProvider';\nimport type { CoinListClient } from '@/client/core/coinlist-client';\n\nexport interface UseCoinListResult {\n /**\n * Indicates whether the CoinList client has been initialized and ready to use.\n * While isReady is false, then the current user state will be `unknown`.\n */\n isReady: boolean;\n coinlist: CoinListClient;\n}\n\nexport function useCoinList(): UseCoinListResult {\n const context = useContext(CoinListContext);\n if (context === null) {\n throw new CoinListClientInitializationError();\n }\n\n return {\n isReady: context.isReady,\n coinlist: context.coinlist,\n };\n}\n\nexport class CoinListClientInitializationError extends Error {\n constructor(\n message = 'useCoinList() must be used within CoinListProvider. Wrap your app with <CoinListProvider config={...}>.'\n ) {\n super(message);\n this.name = 'CoinListClientInitializationError';\n }\n}\n","/**\n * Global CoinList initialization for React apps.\n * Wrap your app once at the root; use useCoinList() anywhere below.\n */\n\nimport {\n createContext,\n type ReactNode,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport {\n type ClientConfig,\n type CoinListClient,\n createCoinListClient,\n} from '@/client/core/coinlist-client';\n\nexport type CoinListContextValue = {\n coinlist: CoinListClient;\n isReady: boolean;\n};\n\nexport const CoinListContext = createContext<CoinListContextValue | null>(null);\n\nexport type CoinListProviderProps = {\n config: ClientConfig;\n children: ReactNode;\n};\n\n/**\n * Provide CoinList (api + config) to the tree. Initialize once at app root with your config.\n */\nexport function CoinListProvider({ config, children }: CoinListProviderProps) {\n const [isReady, setIsReady] = useState(false);\n const coinlist = useMemo(() => createCoinListClient(config), [config]);\n\n useEffect(() => {\n let isCancelled = false;\n if (coinlist.getAuthState() === 'unknown') {\n coinlist\n .init()\n .then(() => {\n if (!isCancelled) {\n setIsReady(true);\n }\n })\n .catch(() => {\n if (!isCancelled) {\n setIsReady(true);\n }\n });\n } else {\n setIsReady(true);\n }\n\n return () => {\n isCancelled = true;\n };\n }, [coinlist]);\n\n const value = useMemo(() => ({ coinlist, isReady }), [coinlist, isReady]);\n\n return (\n <CoinListContext.Provider value={value}>\n {children}\n </CoinListContext.Provider>\n );\n}\n","import { useEffect, useState } from 'react';\nimport { useCoinList } from '@/client/hooks/useCoinList';\nimport { NotAuthenticatedError } from '@/shared/types/errors';\nimport type { OfferId } from '@/shared/types/offer';\nimport type { OfferDetail } from '@/shared/types/offer-detail';\n\nexport type LoadOfferDetailsReason = 'not-authenticated' | 'generic-error';\n\nexport type LoadOfferDetailsState =\n | {\n type: 'LOADING';\n }\n | {\n type: 'ERROR';\n reason: LoadOfferDetailsReason;\n }\n | {\n type: 'CONTENT';\n offerDetail: OfferDetail;\n };\n\nexport interface UseCoinListOfferDetailsOptions {\n /**\n * Offer detail pre-fetched on the server (e.g. via `CoinListServer.fetchOfferDetails()`).\n * When provided, the hook uses this data as-is and skips the client-side fetch entirely.\n */\n serverData?: OfferDetail;\n}\n\nexport interface UseCoinListOfferDetailsResult {\n offerDetailsState: LoadOfferDetailsState;\n}\n\nconst LOADING_STATE: LoadOfferDetailsState = { type: 'LOADING' };\n\n/**\n * Loads CoinList offer details for a given offer id and exposes a UI-friendly state.\n *\n * Pass `serverData` (pre-fetched server-side) to use that data as-is and skip\n * the client-side fetch entirely.\n *\n * Returns `LOADING` while CoinList is initializing or while details are being fetched.\n * Returns `CONTENT` with the offer when `fetchOfferDetails()` succeeds.\n * Returns `ERROR` with:\n * - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}\n * - `generic-error` for any other failure\n */\nexport function useCoinListOfferDetails(\n offerId: OfferId,\n options: UseCoinListOfferDetailsOptions = {}\n): UseCoinListOfferDetailsResult {\n const { coinlist, isReady } = useCoinList();\n const { serverData } = options;\n const [offerDetailsState, setOfferDetailsState] =\n useState<LoadOfferDetailsState>(\n serverData !== undefined\n ? { type: 'CONTENT', offerDetail: serverData }\n : LOADING_STATE\n );\n\n useEffect(() => {\n let isCancelled = false;\n\n if (!isReady) {\n if (serverData === undefined) {\n setOfferDetailsState(LOADING_STATE);\n }\n return () => {\n isCancelled = true;\n };\n }\n\n if (serverData !== undefined) {\n return () => {\n isCancelled = true;\n };\n }\n\n setOfferDetailsState(LOADING_STATE);\n coinlist\n .fetchOfferDetails(offerId)\n .then((offerDetail) => {\n if (!isCancelled) {\n setOfferDetailsState({ type: 'CONTENT', offerDetail });\n }\n })\n .catch((error: unknown) => {\n if (!isCancelled) {\n const reason: LoadOfferDetailsReason =\n error instanceof NotAuthenticatedError\n ? 'not-authenticated'\n : 'generic-error';\n setOfferDetailsState({ type: 'ERROR', reason });\n }\n });\n\n return () => {\n isCancelled = true;\n };\n }, [coinlist, isReady, offerId, serverData]);\n\n return { offerDetailsState };\n}\n","import { useEffect, useState } from 'react';\nimport { useCoinList } from '@/client/hooks/useCoinList';\nimport { NotAuthenticatedError } from '@/shared/types/errors';\nimport type { Offer } from '@/shared/types/offer';\n\nexport type LoadOffersReason = 'not-authenticated' | 'generic-error';\n\nexport type LoadOffersState =\n | {\n type: 'LOADING';\n }\n | {\n type: 'ERROR';\n reason: LoadOffersReason;\n }\n | {\n type: 'CONTENT';\n offers: Offer[];\n };\n\nexport interface UseCoinListOffersOptions {\n /**\n * Offers pre-fetched on the server (e.g. via `CoinListServer.fetchAllOffers()`).\n * When provided, the hook uses this data as-is and skips the client-side fetch entirely.\n */\n serverOffers?: Offer[];\n}\n\nexport interface UseCoinListOffersResult {\n offersState: LoadOffersState;\n}\n\nconst LOADING_STATE: LoadOffersState = { type: 'LOADING' };\n\n/**\n * Loads all CoinList offers for the current user and exposes a UI-friendly state.\n *\n * Pass `serverOffers` (pre-fetched server-side) to use that data as-is and skip\n * the client-side fetch entirely.\n *\n * Returns `LOADING` while CoinList is initializing or while offers are being fetched.\n * Returns `CONTENT` with all offers when `fetchAllOffers()` succeeds.\n * Returns `ERROR` with:\n * - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}\n * - `generic-error` for any other failure\n */\nexport function useCoinListOffers(\n options: UseCoinListOffersOptions = {}\n): UseCoinListOffersResult {\n const { coinlist, isReady } = useCoinList();\n const { serverOffers } = options;\n const [offersState, setOffersState] = useState<LoadOffersState>(\n serverOffers !== undefined\n ? { type: 'CONTENT', offers: serverOffers }\n : LOADING_STATE\n );\n\n useEffect(() => {\n let isCancelled = false;\n\n // Wait until CoinListProvider finishes auth initialization.\n if (!isReady) {\n if (serverOffers === undefined) {\n setOffersState(LOADING_STATE);\n }\n return () => {\n isCancelled = true;\n };\n }\n\n if (serverOffers !== undefined) {\n return () => {\n isCancelled = true;\n };\n }\n\n setOffersState(LOADING_STATE);\n coinlist\n .fetchAllOffers()\n .then((offers) => {\n if (!isCancelled) {\n setOffersState({ type: 'CONTENT', offers });\n }\n })\n .catch((error: unknown) => {\n if (!isCancelled) {\n const reason: LoadOffersReason =\n error instanceof NotAuthenticatedError\n ? 'not-authenticated'\n : 'generic-error';\n setOffersState({ type: 'ERROR', reason });\n }\n });\n\n return () => {\n isCancelled = true;\n };\n }, [coinlist, isReady, serverOffers]);\n\n return { offersState };\n}\n","import { useCallback, useEffect, useState } from 'react';\nimport { useCoinList } from '@/client/hooks/useCoinList';\nimport { NotAuthenticatedError } from '@/shared/types/errors';\nimport type { OfferId } from '@/shared/types/offer';\nimport type { OfferOptionId } from '@/shared/types/offer-detail';\nimport type {\n Requirement,\n RequirementStatusInfo,\n} from '@/shared/types/requirement';\n\nexport type LoadRequirementsReason = 'not-authenticated' | 'generic-error';\n\nexport type LoadRequirementsState =\n | {\n type: 'LOADING';\n }\n | {\n type: 'ERROR';\n reason: LoadRequirementsReason;\n }\n | {\n type: 'CONTENT';\n requirementsByOptionId: Record<OfferOptionId, Requirement[]>;\n statuses: RequirementStatusInfo[];\n };\n\nexport interface UseCoinListRequirementsOptions {\n /**\n * Requirements data pre-fetched on the server (e.g. via\n * `CoinListServer.fetchOfferRequirements()` + `fetchRequirementStatuses()`).\n * When provided, the hook uses this data as-is and skips the initial client-side fetch.\n * Calling `refetch()` will still trigger a fresh fetch.\n */\n serverData?: {\n requirementsByOptionId: Record<OfferOptionId, Requirement[]>;\n statuses: RequirementStatusInfo[];\n };\n}\n\nexport interface UseCoinListRequirementsResult {\n requirementsState: LoadRequirementsState;\n /** Triggers a re-fetch of requirements and statuses. */\n refetch: () => void;\n}\n\nconst LOADING_STATE: LoadRequirementsState = { type: 'LOADING' };\n\n/**\n * Loads requirements (grouped by option ID) and requirement statuses for a\n * given offer, then exposes them via a state machine.\n *\n * Pass `serverData` (pre-fetched server-side) to use that data as-is and skip\n * the initial client-side fetch. Calling `refetch()` will still trigger a fresh fetch.\n *\n * Returns `LOADING` while CoinList is initializing or while data is being fetched.\n * Returns `CONTENT` with requirementsByOptionId and statuses on success.\n * Returns `ERROR` with:\n * - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}\n * - `generic-error` for any other failure\n */\nexport function useCoinListRequirements(\n offerId: OfferId,\n options: UseCoinListRequirementsOptions = {}\n): UseCoinListRequirementsResult {\n const { coinlist, isReady } = useCoinList();\n const { serverData } = options;\n const [requirementsState, setRequirementsState] =\n useState<LoadRequirementsState>(\n serverData !== undefined\n ? { type: 'CONTENT', ...serverData }\n : LOADING_STATE\n );\n const [fetchKey, setFetchKey] = useState(0);\n const refetch = useCallback(() => setFetchKey((k) => k + 1), []);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: fetchKey is an intentional refetch trigger\n useEffect(() => {\n let isCancelled = false;\n\n if (!isReady) {\n if (serverData === undefined) {\n setRequirementsState(LOADING_STATE);\n }\n return () => {\n isCancelled = true;\n };\n }\n\n if (serverData !== undefined && fetchKey === 0) {\n return () => {\n isCancelled = true;\n };\n }\n\n setRequirementsState(LOADING_STATE);\n Promise.all([\n coinlist.fetchOfferRequirements(offerId),\n coinlist.fetchRequirementStatuses(offerId),\n ])\n .then(([requirementsByOptionId, statuses]) => {\n if (!isCancelled) {\n setRequirementsState({\n type: 'CONTENT',\n requirementsByOptionId,\n statuses,\n });\n }\n })\n .catch((error: unknown) => {\n if (!isCancelled) {\n const reason: LoadRequirementsReason =\n error instanceof NotAuthenticatedError\n ? 'not-authenticated'\n : 'generic-error';\n setRequirementsState({ type: 'ERROR', reason });\n }\n });\n\n return () => {\n isCancelled = true;\n };\n }, [coinlist, isReady, offerId, fetchKey]);\n\n return { requirementsState, refetch };\n}\n","import { useEffect, useRef } from 'react';\nimport type { OauthClientErrorReason } from '@/client/core/types/client-types';\nimport { useCoinList } from '@/client/hooks/useCoinList';\nimport type { AuthorizationCode, CodeVerifier } from '@/shared/types/oauth';\n\n/**\n * Reasons passed to {@link UseCompleteCoinListOAuthOptions.onFailure} when the\n * OAuth callback cannot be completed. Includes PKCE / redirect validation\n * errors from {@link CoinListClient.completeOAuth} and a dedicated value when\n * {@link UseCompleteCoinListOAuthOptions.postOAuthComplete} fails or rejects.\n */\nexport type CompleteCoinListOAuthFailureReason =\n | OauthClientErrorReason\n | 'complete_request_failed';\n\nexport interface UseCompleteCoinListOAuthOptions {\n /**\n * Exchange the authorization code on your backend (e.g. POST to your API).\n * Return `true` when the session was established successfully, `false` when\n * the request completed but signing in failed. Rejections are treated like\n * `false` and reported as {@link CompleteCoinListOAuthFailureReason}\n * `\"complete_request_failed\"`.\n */\n postOAuthComplete: (payload: {\n code: AuthorizationCode;\n codeVerifier: CodeVerifier;\n }) => Promise<boolean>;\n /**\n * Called when the user denied access (`error` query parameter), when\n * {@link CoinListClient.completeOAuth} fails PKCE/state validation, or when\n * {@link UseCompleteCoinListOAuthOptions.postOAuthComplete} fails.\n */\n onFailure: (\n reason: CompleteCoinListOAuthFailureReason\n ) => void | Promise<void>;\n /** Invoked after {@link UseCompleteCoinListOAuthOptions.postOAuthComplete} succeeds and {@link CoinListClient.init} has refreshed the client session. */\n onSuccess: () => void | Promise<void>;\n}\n\n/**\n * Runs the CoinList OAuth callback once on mount: validates the redirect URL via\n * {@link CoinListClient.completeOAuth}, exchanges the code via {@link UseCompleteCoinListOAuthOptions.postOAuthComplete},\n * refreshes tokens with {@link CoinListClient.init}, then calls {@link UseCompleteCoinListOAuthOptions.onSuccess}.\n *\n * Framework-agnostic: reads `window.location` like {@link CoinListClient.completeOAuth}. Supply\n * {@link UseCompleteCoinListOAuthOptions.postOAuthComplete}, {@link UseCompleteCoinListOAuthOptions.onFailure},\n * and {@link UseCompleteCoinListOAuthOptions.onSuccess} to perform redirects or routing in your app.\n *\n * Must be used within {@link CoinListProvider}.\n */\nexport function useCompleteCoinListOAuth(\n options: UseCompleteCoinListOAuthOptions\n): void {\n const { coinlist } = useCoinList();\n\n const postOAuthCompleteRef = useRef(options.postOAuthComplete);\n const onFailureRef = useRef(options.onFailure);\n const onSuccessRef = useRef(options.onSuccess);\n\n postOAuthCompleteRef.current = options.postOAuthComplete;\n onFailureRef.current = options.onFailure;\n onSuccessRef.current = options.onSuccess;\n\n const hasStartedExchangeRef = useRef(false);\n\n useEffect(() => {\n if (typeof window === 'undefined') return;\n\n const params = new URLSearchParams(window.location.search);\n if (!params.has('code') && !params.has('error')) return;\n\n if (hasStartedExchangeRef.current) return;\n\n const oauthResult = coinlist.completeOAuth();\n if (oauthResult.type === 'error') {\n void Promise.resolve(onFailureRef.current(oauthResult.reason)).catch(\n () => {}\n );\n return;\n }\n\n hasStartedExchangeRef.current = true;\n let cancelled = false;\n\n void (async () => {\n try {\n const ok = await postOAuthCompleteRef.current({\n code: oauthResult.code,\n codeVerifier: oauthResult.codeVerifier,\n });\n\n if (cancelled) return;\n\n if (!ok) {\n hasStartedExchangeRef.current = false;\n await onFailureRef.current('complete_request_failed');\n return;\n }\n\n await coinlist.init();\n\n if (cancelled) return;\n\n await onSuccessRef.current();\n } catch {\n if (cancelled) return;\n hasStartedExchangeRef.current = false;\n await onFailureRef.current('complete_request_failed');\n }\n })();\n\n return () => {\n cancelled = true;\n hasStartedExchangeRef.current = false;\n };\n }, [coinlist]);\n}\n","import { useEffect, useState } from 'react';\nimport { useCoinList } from '@/client/hooks/useCoinList';\nimport { NotAuthenticatedError } from '@/shared/types/errors';\nimport type { OfferId } from '@/shared/types/offer';\nimport type { Participation } from '@/shared/types/participation';\n\nexport type LoadParticipationsReason = 'not-authenticated' | 'generic-error';\n\nexport type LoadParticipationsState =\n | {\n type: 'LOADING';\n }\n | {\n type: 'ERROR';\n reason: LoadParticipationsReason;\n }\n | {\n type: 'CONTENT';\n participations: Participation[];\n };\n\nexport interface UseParticipationsOptions {\n /**\n * Participations pre-fetched on the server (e.g. via `CoinListServer.fetchAllParticipations()`).\n * When provided, the hook uses this data as-is and skips the client-side fetch entirely.\n */\n serverData?: Participation[];\n}\n\nexport interface UseParticipationsResult {\n participationsState: LoadParticipationsState;\n}\n\nconst LOADING_STATE: LoadParticipationsState = { type: 'LOADING' };\n\n/**\n * Loads all CoinList participations for the current user and exposes a UI-friendly state.\n * Optionally filters by offer when `offerId` is provided.\n *\n * Pass `serverData` (pre-fetched server-side) to use that data as-is and skip\n * the client-side fetch entirely.\n *\n * Returns `LOADING` while CoinList is initializing or while participations are being fetched.\n * Returns `CONTENT` with all participations when `fetchAllParticipations()` succeeds.\n * Returns `ERROR` with:\n * - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}\n * - `generic-error` for any other failure\n */\nexport function useParticipations(\n offerId?: OfferId,\n options: UseParticipationsOptions = {}\n): UseParticipationsResult {\n const { coinlist, isReady } = useCoinList();\n const { serverData } = options;\n const [participationsState, setParticipationsState] =\n useState<LoadParticipationsState>(\n serverData !== undefined\n ? { type: 'CONTENT', participations: serverData }\n : LOADING_STATE\n );\n\n useEffect(() => {\n let isCancelled = false;\n\n // Wait until CoinListProvider finishes auth initialization.\n if (!isReady) {\n if (serverData === undefined) {\n setParticipationsState(LOADING_STATE);\n }\n return () => {\n isCancelled = true;\n };\n }\n\n if (serverData !== undefined) {\n return () => {\n isCancelled = true;\n };\n }\n\n setParticipationsState(LOADING_STATE);\n coinlist\n .fetchAllParticipations(offerId)\n .then((participations) => {\n if (!isCancelled) {\n setParticipationsState({ type: 'CONTENT', participations });\n }\n })\n .catch((error: unknown) => {\n if (!isCancelled) {\n const reason: LoadParticipationsReason =\n error instanceof NotAuthenticatedError\n ? 'not-authenticated'\n : 'generic-error';\n setParticipationsState({ type: 'ERROR', reason });\n }\n });\n\n return () => {\n isCancelled = true;\n };\n }, [coinlist, isReady, offerId, serverData]);\n\n return { participationsState };\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,kBAAkB;;;ACK3B;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAqDH;AAzCG,IAAM,kBAAkB,cAA2C,IAAI;AAUvE,SAAS,iBAAiB,EAAE,QAAQ,SAAS,GAA0B;AAC5E,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,WAAW,QAAQ,MAAM,qBAAqB,MAAM,GAAG,CAAC,MAAM,CAAC;AAErE,YAAU,MAAM;AACd,QAAI,cAAc;AAClB,QAAI,SAAS,aAAa,MAAM,WAAW;AACzC,eACG,KAAK,EACL,KAAK,MAAM;AACV,YAAI,CAAC,aAAa;AAChB,qBAAW,IAAI;AAAA,QACjB;AAAA,MACF,CAAC,EACA,MAAM,MAAM;AACX,YAAI,CAAC,aAAa;AAChB,qBAAW,IAAI;AAAA,QACjB;AAAA,MACF,CAAC;AAAA,IACL,OAAO;AACL,iBAAW,IAAI;AAAA,IACjB;AAEA,WAAO,MAAM;AACX,oBAAc;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,QAAM,QAAQ,QAAQ,OAAO,EAAE,UAAU,QAAQ,IAAI,CAAC,UAAU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EH,WAAO,MAAM;AACX,kBAAY;AACZ,4BAAsB,UAAU;AAAA,IAClC;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AACf;;;ACpHA,SAAS,aAAAC,YAAW,YAAAC,iBAAgB;AAiCpC,IAAMC,iBAAyC,EAAE,MAAM,UAAU;AAe1D,SAAS,kBACd,SACA,UAAoC,CAAC,GACZ;AACzB,QAAM,EAAE,UAAU,QAAQ,IAAI,YAAY;AAC1C,QAAM,EAAE,WAAW,IAAI;AACvB,QAAM,CAAC,qBAAqB,sBAAsB,IAChDC;AAAA,IACE,eAAe,SACX,EAAE,MAAM,WAAW,gBAAgB,WAAW,IAC9CD;AAAA,EACN;AAEF,EAAAE,WAAU,MAAM;AACd,QAAI,cAAc;AAGlB,QAAI,CAAC,SAAS;AACZ,UAAI,eAAe,QAAW;AAC5B,+BAAuBF,cAAa;AAAA,MACtC;AACA,aAAO,MAAM;AACX,sBAAc;AAAA,MAChB;AAAA,IACF;AAEA,QAAI,eAAe,QAAW;AAC5B,aAAO,MAAM;AACX,sBAAc;AAAA,MAChB;AAAA,IACF;AAEA,2BAAuBA,cAAa;AACpC,aACG,uBAAuB,OAAO,EAC9B,KAAK,CAAC,mBAAmB;AACxB,UAAI,CAAC,aAAa;AAChB,+BAAuB,EAAE,MAAM,WAAW,eAAe,CAAC;AAAA,MAC5D;AAAA,IACF,CAAC,EACA,MAAM,CAAC,UAAmB;AACzB,UAAI,CAAC,aAAa;AAChB,cAAM,SACJ,iBAAiB,wBACb,sBACA;AACN,+BAAuB,EAAE,MAAM,SAAS,OAAO,CAAC;AAAA,MAClD;AAAA,IACF,CAAC;AAEH,WAAO,MAAM;AACX,oBAAc;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,UAAU,SAAS,SAAS,UAAU,CAAC;AAE3C,SAAO,EAAE,oBAAoB;AAC/B;","names":["useEffect","useState","useState","useEffect","useEffect","useState","LOADING_STATE","useState","useEffect","useEffect","useState","LOADING_STATE","useState","useEffect","useEffect","useEffect","useEffect","useState","LOADING_STATE","useState","useEffect"]}
|
package/dist/chunk-YJQMJFA7.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// src/shared/types/user.ts
|
|
2
|
-
var UserId = (value) => value;
|
|
3
|
-
var UserEmail = (value) => value;
|
|
4
|
-
var User = {
|
|
5
|
-
fromDto: (dto) => ({
|
|
6
|
-
id: UserId(dto.id),
|
|
7
|
-
email: UserEmail(dto.email)
|
|
8
|
-
})
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
UserId,
|
|
13
|
-
UserEmail,
|
|
14
|
-
User
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=chunk-YJQMJFA7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|