@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
@@ -1,56 +0,0 @@
1
- import { N as Newtype } from './newtype-yKTvFdg_.js';
2
-
3
- type AuthorizationCode = Newtype<string, 'AuthorizationCode'>;
4
- declare const AuthorizationCode: (value: string) => AuthorizationCode;
5
- type CodeVerifier = Newtype<string, 'CodeVerifier'>;
6
- declare const CodeVerifier: (value: string) => CodeVerifier;
7
- type CodeChallenge = Newtype<string, 'CodeChallenge'>;
8
- declare const CodeChallenge: (value: string) => CodeChallenge;
9
- type RedirectUri = Newtype<string, 'RedirectUri'>;
10
- declare const RedirectUri: (value: string) => RedirectUri;
11
- type ClientId = Newtype<string, 'ClientId'>;
12
- declare const ClientId: (value: string) => ClientId;
13
- type ClientSecret = Newtype<string, 'ClientSecret'>;
14
- declare const ClientSecret: (value: string) => ClientSecret;
15
-
16
- interface Config {
17
- /** OAuth2 public identifier. */
18
- readonly clientId: ClientId;
19
- /**
20
- * OAuth2 redirect URI. Recommended to point to a frontend page where
21
- * {@link CoinListClient#completeOauth} can be called to complete the PKCE
22
- * flow on the client side.
23
- */
24
- readonly redirectUri: RedirectUri;
25
- /**
26
- * Recommended to leave undefined. Used to change the CoinList environment;
27
- * default is production.
28
- */
29
- readonly baseUrl?: string;
30
- }
31
-
32
- /**
33
- * OAuth 2.0 token response (RFC 6749 §5.1).
34
- * Maps to OpenAPI schema OauthToken.
35
- */
36
- type OAuthSessionDto = {
37
- access_token: string;
38
- expires_in: number;
39
- refresh_token?: string;
40
- };
41
-
42
- type OAuthAccessToken = {
43
- value: string;
44
- expiresAt: Date;
45
- };
46
- type OAuthRefreshToken = Newtype<string, 'OAuthRefreshToken'>;
47
- declare const OAuthRefreshToken: (value: string) => OAuthRefreshToken;
48
- type OAuthSession = {
49
- accessToken: OAuthAccessToken;
50
- refreshToken?: OAuthRefreshToken;
51
- };
52
- declare const OAuthSession: {
53
- fromDto: (dto: OAuthSessionDto) => OAuthSession;
54
- };
55
-
56
- export { AuthorizationCode as A, ClientId as C, type OAuthAccessToken as O, RedirectUri as R, ClientSecret as a, CodeChallenge as b, CodeVerifier as c, OAuthRefreshToken as d, OAuthSession as e, type Config as f };
@@ -1,202 +0,0 @@
1
- import { N as Newtype } from './newtype-yKTvFdg_.cjs';
2
-
3
- type OfferDto = {
4
- id: string;
5
- slug: string;
6
- tagline: string | null | undefined;
7
- banner_url: string | null | undefined;
8
- logo_url: string | null | undefined;
9
- starts_at: string;
10
- ends_at: string;
11
- };
12
-
13
- type OfferId = Newtype<string, 'OfferId'>;
14
- declare const OfferId: (value: string) => OfferId;
15
- type OfferSlug = Newtype<string, 'OfferSlug'>;
16
- declare const OfferSlug: (value: string) => OfferSlug;
17
- type Offer = {
18
- id: OfferId;
19
- slug: OfferSlug;
20
- tagline: string | null;
21
- bannerUrl: string | null;
22
- logoUrl: string | null;
23
- startsAt: Date;
24
- endsAt: Date;
25
- };
26
- declare const Offer: {
27
- fromDto: (dto: OfferDto) => Offer;
28
- };
29
-
30
- type AssetDto = {
31
- code: string;
32
- fractional_digits: number;
33
- id: string;
34
- name: string;
35
- };
36
-
37
- type AssetId = Newtype<string, 'AssetId'>;
38
- declare const AssetId: (value: string) => AssetId;
39
- type AssetCode = Newtype<string, 'AssetCode'>;
40
- declare const AssetCode: (value: string) => AssetCode;
41
- type Asset = {
42
- id: AssetId;
43
- code: AssetCode;
44
- name: string;
45
- fractionalDigits: number;
46
- };
47
- declare const Asset: {
48
- fromDto: (dto: AssetDto) => Asset;
49
- };
50
-
51
- type OfferDetailDto = {
52
- asset: AssetDto;
53
- faqs: OfferDetailFaqDto[];
54
- funding_assets: AssetDto[];
55
- id: string;
56
- links: OfferDetailLinkDto[];
57
- milestones: OfferDetailMilestoneDto[];
58
- name: string;
59
- object: 'offer_details';
60
- options: OfferDetailOptionDto[];
61
- slug: string;
62
- terms: OfferDetailTermDto[];
63
- about: string | null | undefined;
64
- banner_url: string | null | undefined;
65
- category: string | null | undefined;
66
- ends_at: string;
67
- logo_url: string | null | undefined;
68
- starts_at: string;
69
- tagline: string | null | undefined;
70
- };
71
- type OfferDetailFaqDto = {
72
- answer: string | null;
73
- question: string | null;
74
- };
75
- type OfferDetailLinkDto = {
76
- label: string | null;
77
- url: string | null;
78
- };
79
- type OfferDetailMilestoneDto = {
80
- name: string | null;
81
- schedule: string | null;
82
- status: 'completed' | 'active' | 'upcoming';
83
- };
84
- type OfferDetailOptionDto = {
85
- bid_increment: number | null;
86
- floor_price_usd: number | null;
87
- id: string;
88
- minimum_purchase_usd: number | null;
89
- price_usd: string | null;
90
- sale_agreement_url: string | null;
91
- slug: string;
92
- total_token_supply: number | null;
93
- };
94
- type OfferDetailTermDto = {
95
- key: string | null;
96
- value: string | null;
97
- };
98
-
99
- type OfferOptionId = Newtype<string, 'OfferOptionId'>;
100
- declare const OfferOptionId: (value: string) => OfferOptionId;
101
- type OfferOptionSlug = Newtype<string, 'OfferOptionSlug'>;
102
- declare const OfferOptionSlug: (value: string) => OfferOptionSlug;
103
- type OfferDetail = {
104
- id: OfferId;
105
- slug: OfferSlug;
106
- name: string;
107
- asset: Asset;
108
- fundingAssets: Asset[];
109
- about: string | null;
110
- tagline: string | null;
111
- bannerUrl: string | null;
112
- logoUrl: string | null;
113
- category: string | null;
114
- startsAt: Date;
115
- endsAt: Date;
116
- faqs: FaqItem[];
117
- links: Link[];
118
- milestones: Milestone[];
119
- options: OfferOption[];
120
- terms: TermItem[];
121
- };
122
- declare const OfferDetail: {
123
- fromDto: (dto: OfferDetailDto) => OfferDetail;
124
- };
125
- type OfferOption = {
126
- id: OfferOptionId;
127
- slug: OfferOptionSlug;
128
- bidIncrement: number | null;
129
- floorPriceUsd: number | null;
130
- minimumPurchaseUsd: number | null;
131
- priceUsd: string | null;
132
- saleAgreementUrl: string | null;
133
- totalTokenSupply: number | null;
134
- };
135
- declare const OfferOption: {
136
- fromDto: (dto: OfferDetailOptionDto) => OfferOption;
137
- };
138
- type FaqItem = {
139
- question: string | null;
140
- answer: string | null;
141
- };
142
- declare const FaqItem: {
143
- fromDto: (dto: OfferDetailFaqDto) => FaqItem;
144
- };
145
- type Link = {
146
- label: string | null;
147
- url: string | null;
148
- };
149
- declare const Link: {
150
- fromDto: (dto: OfferDetailLinkDto) => Link;
151
- };
152
- type TermItem = {
153
- key: string | null;
154
- value: string | null;
155
- };
156
- declare const TermItem: {
157
- fromDto: (dto: OfferDetailTermDto) => TermItem;
158
- };
159
- type Milestone = {
160
- name: string | null;
161
- schedule: string | null;
162
- status: 'completed' | 'active' | 'upcoming';
163
- };
164
- declare const Milestone: {
165
- fromDto: (dto: OfferDetailMilestoneDto) => Milestone;
166
- };
167
-
168
- type RequirementTypeDto = 'kyc_approved' | 'identity_verified' | 'proof_of_address' | 'source_of_funds' | 'external_wallet' | 'whitelisted_wallet' | 'jurisdiction' | 'accreditation';
169
- type RequirementDto = {
170
- object: 'requirement';
171
- id: string;
172
- type: RequirementTypeDto;
173
- details: Record<string, unknown> | null;
174
- };
175
- type RequirementStatusValueDto = 'not_started' | 'in_progress' | 'action_needed' | 'completed' | 'rejected';
176
- type RequirementStatusesDto = {
177
- object: 'requirement_statuses';
178
- offer_id: string;
179
- statuses: Record<string, RequirementStatusValueDto>;
180
- };
181
-
182
- type RequirementId = Newtype<string, 'RequirementId'>;
183
- declare const RequirementId: (value: string) => RequirementId;
184
- type RequirementType = RequirementTypeDto;
185
- type RequirementStatusValue = RequirementStatusValueDto;
186
- type Requirement = {
187
- id: RequirementId;
188
- type: RequirementType;
189
- details: Record<string, unknown> | null;
190
- };
191
- declare const Requirement: {
192
- fromDto: (dto: RequirementDto) => Requirement;
193
- };
194
- type RequirementStatusInfo = {
195
- id: RequirementId;
196
- status: RequirementStatusValue;
197
- };
198
- declare const RequirementStatusInfo: {
199
- fromStatusesDto: (dto: RequirementStatusesDto) => RequirementStatusInfo[];
200
- };
201
-
202
- export { type AssetDto as A, FaqItem as F, Link as L, Milestone as M, Offer as O, Requirement as R, TermItem as T, OfferDetail as a, OfferId as b, OfferOption as c, OfferOptionId as d, OfferOptionSlug as e, OfferSlug as f, RequirementId as g, RequirementStatusInfo as h, type RequirementStatusValue as i, type RequirementType as j, Asset as k, AssetId as l };
@@ -1,202 +0,0 @@
1
- import { N as Newtype } from './newtype-yKTvFdg_.js';
2
-
3
- type OfferDto = {
4
- id: string;
5
- slug: string;
6
- tagline: string | null | undefined;
7
- banner_url: string | null | undefined;
8
- logo_url: string | null | undefined;
9
- starts_at: string;
10
- ends_at: string;
11
- };
12
-
13
- type OfferId = Newtype<string, 'OfferId'>;
14
- declare const OfferId: (value: string) => OfferId;
15
- type OfferSlug = Newtype<string, 'OfferSlug'>;
16
- declare const OfferSlug: (value: string) => OfferSlug;
17
- type Offer = {
18
- id: OfferId;
19
- slug: OfferSlug;
20
- tagline: string | null;
21
- bannerUrl: string | null;
22
- logoUrl: string | null;
23
- startsAt: Date;
24
- endsAt: Date;
25
- };
26
- declare const Offer: {
27
- fromDto: (dto: OfferDto) => Offer;
28
- };
29
-
30
- type AssetDto = {
31
- code: string;
32
- fractional_digits: number;
33
- id: string;
34
- name: string;
35
- };
36
-
37
- type AssetId = Newtype<string, 'AssetId'>;
38
- declare const AssetId: (value: string) => AssetId;
39
- type AssetCode = Newtype<string, 'AssetCode'>;
40
- declare const AssetCode: (value: string) => AssetCode;
41
- type Asset = {
42
- id: AssetId;
43
- code: AssetCode;
44
- name: string;
45
- fractionalDigits: number;
46
- };
47
- declare const Asset: {
48
- fromDto: (dto: AssetDto) => Asset;
49
- };
50
-
51
- type OfferDetailDto = {
52
- asset: AssetDto;
53
- faqs: OfferDetailFaqDto[];
54
- funding_assets: AssetDto[];
55
- id: string;
56
- links: OfferDetailLinkDto[];
57
- milestones: OfferDetailMilestoneDto[];
58
- name: string;
59
- object: 'offer_details';
60
- options: OfferDetailOptionDto[];
61
- slug: string;
62
- terms: OfferDetailTermDto[];
63
- about: string | null | undefined;
64
- banner_url: string | null | undefined;
65
- category: string | null | undefined;
66
- ends_at: string;
67
- logo_url: string | null | undefined;
68
- starts_at: string;
69
- tagline: string | null | undefined;
70
- };
71
- type OfferDetailFaqDto = {
72
- answer: string | null;
73
- question: string | null;
74
- };
75
- type OfferDetailLinkDto = {
76
- label: string | null;
77
- url: string | null;
78
- };
79
- type OfferDetailMilestoneDto = {
80
- name: string | null;
81
- schedule: string | null;
82
- status: 'completed' | 'active' | 'upcoming';
83
- };
84
- type OfferDetailOptionDto = {
85
- bid_increment: number | null;
86
- floor_price_usd: number | null;
87
- id: string;
88
- minimum_purchase_usd: number | null;
89
- price_usd: string | null;
90
- sale_agreement_url: string | null;
91
- slug: string;
92
- total_token_supply: number | null;
93
- };
94
- type OfferDetailTermDto = {
95
- key: string | null;
96
- value: string | null;
97
- };
98
-
99
- type OfferOptionId = Newtype<string, 'OfferOptionId'>;
100
- declare const OfferOptionId: (value: string) => OfferOptionId;
101
- type OfferOptionSlug = Newtype<string, 'OfferOptionSlug'>;
102
- declare const OfferOptionSlug: (value: string) => OfferOptionSlug;
103
- type OfferDetail = {
104
- id: OfferId;
105
- slug: OfferSlug;
106
- name: string;
107
- asset: Asset;
108
- fundingAssets: Asset[];
109
- about: string | null;
110
- tagline: string | null;
111
- bannerUrl: string | null;
112
- logoUrl: string | null;
113
- category: string | null;
114
- startsAt: Date;
115
- endsAt: Date;
116
- faqs: FaqItem[];
117
- links: Link[];
118
- milestones: Milestone[];
119
- options: OfferOption[];
120
- terms: TermItem[];
121
- };
122
- declare const OfferDetail: {
123
- fromDto: (dto: OfferDetailDto) => OfferDetail;
124
- };
125
- type OfferOption = {
126
- id: OfferOptionId;
127
- slug: OfferOptionSlug;
128
- bidIncrement: number | null;
129
- floorPriceUsd: number | null;
130
- minimumPurchaseUsd: number | null;
131
- priceUsd: string | null;
132
- saleAgreementUrl: string | null;
133
- totalTokenSupply: number | null;
134
- };
135
- declare const OfferOption: {
136
- fromDto: (dto: OfferDetailOptionDto) => OfferOption;
137
- };
138
- type FaqItem = {
139
- question: string | null;
140
- answer: string | null;
141
- };
142
- declare const FaqItem: {
143
- fromDto: (dto: OfferDetailFaqDto) => FaqItem;
144
- };
145
- type Link = {
146
- label: string | null;
147
- url: string | null;
148
- };
149
- declare const Link: {
150
- fromDto: (dto: OfferDetailLinkDto) => Link;
151
- };
152
- type TermItem = {
153
- key: string | null;
154
- value: string | null;
155
- };
156
- declare const TermItem: {
157
- fromDto: (dto: OfferDetailTermDto) => TermItem;
158
- };
159
- type Milestone = {
160
- name: string | null;
161
- schedule: string | null;
162
- status: 'completed' | 'active' | 'upcoming';
163
- };
164
- declare const Milestone: {
165
- fromDto: (dto: OfferDetailMilestoneDto) => Milestone;
166
- };
167
-
168
- type RequirementTypeDto = 'kyc_approved' | 'identity_verified' | 'proof_of_address' | 'source_of_funds' | 'external_wallet' | 'whitelisted_wallet' | 'jurisdiction' | 'accreditation';
169
- type RequirementDto = {
170
- object: 'requirement';
171
- id: string;
172
- type: RequirementTypeDto;
173
- details: Record<string, unknown> | null;
174
- };
175
- type RequirementStatusValueDto = 'not_started' | 'in_progress' | 'action_needed' | 'completed' | 'rejected';
176
- type RequirementStatusesDto = {
177
- object: 'requirement_statuses';
178
- offer_id: string;
179
- statuses: Record<string, RequirementStatusValueDto>;
180
- };
181
-
182
- type RequirementId = Newtype<string, 'RequirementId'>;
183
- declare const RequirementId: (value: string) => RequirementId;
184
- type RequirementType = RequirementTypeDto;
185
- type RequirementStatusValue = RequirementStatusValueDto;
186
- type Requirement = {
187
- id: RequirementId;
188
- type: RequirementType;
189
- details: Record<string, unknown> | null;
190
- };
191
- declare const Requirement: {
192
- fromDto: (dto: RequirementDto) => Requirement;
193
- };
194
- type RequirementStatusInfo = {
195
- id: RequirementId;
196
- status: RequirementStatusValue;
197
- };
198
- declare const RequirementStatusInfo: {
199
- fromStatusesDto: (dto: RequirementStatusesDto) => RequirementStatusInfo[];
200
- };
201
-
202
- export { type AssetDto as A, FaqItem as F, Link as L, Milestone as M, Offer as O, Requirement as R, TermItem as T, OfferDetail as a, OfferId as b, OfferOption as c, OfferOptionId as d, OfferOptionSlug as e, OfferSlug as f, RequirementId as g, RequirementStatusInfo as h, type RequirementStatusValue as i, type RequirementType as j, Asset as k, AssetId as l };
@@ -1,27 +0,0 @@
1
- import { O as Offer } from './requirement-fJsQ3f9_.js';
2
-
3
- type LoadOffersReason = 'not-authenticated' | 'generic-error';
4
- type LoadOffersState = {
5
- type: 'LOADING';
6
- } | {
7
- type: 'ERROR';
8
- reason: LoadOffersReason;
9
- } | {
10
- type: 'CONTENT';
11
- offers: Offer[];
12
- };
13
- interface UseCoinListOffersResult {
14
- offersState: LoadOffersState;
15
- }
16
- /**
17
- * Loads all CoinList offers for the current user and exposes a UI-friendly state.
18
- *
19
- * Returns `LOADING` while CoinList is initializing or while offers are being fetched.
20
- * Returns `CONTENT` with all offers when `fetchAllOffers()` succeeds.
21
- * Returns `ERROR` with:
22
- * - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}
23
- * - `generic-error` for any other failure
24
- */
25
- declare function useCoinListOffers(): UseCoinListOffersResult;
26
-
27
- export { type LoadOffersState as L, useCoinListOffers as u };
@@ -1,27 +0,0 @@
1
- import { O as Offer } from './requirement-CxbdY8l4.cjs';
2
-
3
- type LoadOffersReason = 'not-authenticated' | 'generic-error';
4
- type LoadOffersState = {
5
- type: 'LOADING';
6
- } | {
7
- type: 'ERROR';
8
- reason: LoadOffersReason;
9
- } | {
10
- type: 'CONTENT';
11
- offers: Offer[];
12
- };
13
- interface UseCoinListOffersResult {
14
- offersState: LoadOffersState;
15
- }
16
- /**
17
- * Loads all CoinList offers for the current user and exposes a UI-friendly state.
18
- *
19
- * Returns `LOADING` while CoinList is initializing or while offers are being fetched.
20
- * Returns `CONTENT` with all offers when `fetchAllOffers()` succeeds.
21
- * Returns `ERROR` with:
22
- * - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}
23
- * - `generic-error` for any other failure
24
- */
25
- declare function useCoinListOffers(): UseCoinListOffersResult;
26
-
27
- export { type LoadOffersState as L, useCoinListOffers as u };
@@ -1,31 +0,0 @@
1
- import { d as OfferOptionId, R as Requirement, h as RequirementStatusInfo, b as OfferId } from './requirement-fJsQ3f9_.js';
2
-
3
- type LoadRequirementsReason = 'not-authenticated' | 'generic-error';
4
- type LoadRequirementsState = {
5
- type: 'LOADING';
6
- } | {
7
- type: 'ERROR';
8
- reason: LoadRequirementsReason;
9
- } | {
10
- type: 'CONTENT';
11
- requirementsByOptionId: Record<OfferOptionId, Requirement[]>;
12
- statuses: RequirementStatusInfo[];
13
- };
14
- interface UseCoinListRequirementsResult {
15
- requirementsState: LoadRequirementsState;
16
- /** Triggers a re-fetch of requirements and statuses. */
17
- refetch: () => void;
18
- }
19
- /**
20
- * Loads requirements (grouped by option ID) and requirement statuses for a
21
- * given offer, then exposes them via a state machine.
22
- *
23
- * Returns `LOADING` while CoinList is initializing or while data is being fetched.
24
- * Returns `CONTENT` with requirementsByOptionId and statuses on success.
25
- * Returns `ERROR` with:
26
- * - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}
27
- * - `generic-error` for any other failure
28
- */
29
- declare function useCoinListRequirements(offerId: OfferId): UseCoinListRequirementsResult;
30
-
31
- export { type LoadRequirementsReason as L, type UseCoinListRequirementsResult as U, type LoadRequirementsState as a, useCoinListRequirements as u };
@@ -1,31 +0,0 @@
1
- import { d as OfferOptionId, R as Requirement, h as RequirementStatusInfo, b as OfferId } from './requirement-CxbdY8l4.cjs';
2
-
3
- type LoadRequirementsReason = 'not-authenticated' | 'generic-error';
4
- type LoadRequirementsState = {
5
- type: 'LOADING';
6
- } | {
7
- type: 'ERROR';
8
- reason: LoadRequirementsReason;
9
- } | {
10
- type: 'CONTENT';
11
- requirementsByOptionId: Record<OfferOptionId, Requirement[]>;
12
- statuses: RequirementStatusInfo[];
13
- };
14
- interface UseCoinListRequirementsResult {
15
- requirementsState: LoadRequirementsState;
16
- /** Triggers a re-fetch of requirements and statuses. */
17
- refetch: () => void;
18
- }
19
- /**
20
- * Loads requirements (grouped by option ID) and requirement statuses for a
21
- * given offer, then exposes them via a state machine.
22
- *
23
- * Returns `LOADING` while CoinList is initializing or while data is being fetched.
24
- * Returns `CONTENT` with requirementsByOptionId and statuses on success.
25
- * Returns `ERROR` with:
26
- * - `not-authenticated` when fetching fails with {@link NotAuthenticatedError}
27
- * - `generic-error` for any other failure
28
- */
29
- declare function useCoinListRequirements(offerId: OfferId): UseCoinListRequirementsResult;
30
-
31
- export { type LoadRequirementsReason as L, type UseCoinListRequirementsResult as U, type LoadRequirementsState as a, useCoinListRequirements as u };
@@ -1,55 +0,0 @@
1
- import { a as CoinListClient, O as OauthClientErrorReason } from './coinlist-client-DBKa6j3f.cjs';
2
- import { A as AuthorizationCode, c as CodeVerifier } from './oauth-session-DgItaMKN.cjs';
3
-
4
- interface UseCoinListResult {
5
- /**
6
- * Indicates whether the CoinList client has been initialized and ready to use.
7
- * While isReady is false, then the current user state will be `unknown`.
8
- */
9
- isReady: boolean;
10
- coinlist: CoinListClient;
11
- }
12
- declare function useCoinList(): UseCoinListResult;
13
-
14
- /**
15
- * Reasons passed to {@link UseCompleteCoinListOAuthOptions.onFailure} when the
16
- * OAuth callback cannot be completed. Includes PKCE / redirect validation
17
- * errors from {@link CoinListClient.completeOAuth} and a dedicated value when
18
- * {@link UseCompleteCoinListOAuthOptions.postOAuthComplete} fails or rejects.
19
- */
20
- type CompleteCoinListOAuthFailureReason = OauthClientErrorReason | 'complete_request_failed';
21
- interface UseCompleteCoinListOAuthOptions {
22
- /**
23
- * Exchange the authorization code on your backend (e.g. POST to your API).
24
- * Return `true` when the session was established successfully, `false` when
25
- * the request completed but signing in failed. Rejections are treated like
26
- * `false` and reported as {@link CompleteCoinListOAuthFailureReason}
27
- * `"complete_request_failed"`.
28
- */
29
- postOAuthComplete: (payload: {
30
- code: AuthorizationCode;
31
- codeVerifier: CodeVerifier;
32
- }) => Promise<boolean>;
33
- /**
34
- * Called when the user denied access (`error` query parameter), when
35
- * {@link CoinListClient.completeOAuth} fails PKCE/state validation, or when
36
- * {@link UseCompleteCoinListOAuthOptions.postOAuthComplete} fails.
37
- */
38
- onFailure: (reason: CompleteCoinListOAuthFailureReason) => void | Promise<void>;
39
- /** Invoked after {@link UseCompleteCoinListOAuthOptions.postOAuthComplete} succeeds and {@link CoinListClient.init} has refreshed the client session. */
40
- onSuccess: () => void | Promise<void>;
41
- }
42
- /**
43
- * Runs the CoinList OAuth callback once on mount: validates the redirect URL via
44
- * {@link CoinListClient.completeOAuth}, exchanges the code via {@link UseCompleteCoinListOAuthOptions.postOAuthComplete},
45
- * refreshes tokens with {@link CoinListClient.init}, then calls {@link UseCompleteCoinListOAuthOptions.onSuccess}.
46
- *
47
- * Framework-agnostic: reads `window.location` like {@link CoinListClient.completeOAuth}. Supply
48
- * {@link UseCompleteCoinListOAuthOptions.postOAuthComplete}, {@link UseCompleteCoinListOAuthOptions.onFailure},
49
- * and {@link UseCompleteCoinListOAuthOptions.onSuccess} to perform redirects or routing in your app.
50
- *
51
- * Must be used within {@link CoinListProvider}.
52
- */
53
- declare function useCompleteCoinListOAuth(options: UseCompleteCoinListOAuthOptions): void;
54
-
55
- export { type CompleteCoinListOAuthFailureReason as C, type UseCompleteCoinListOAuthOptions as U, useCompleteCoinListOAuth as a, useCoinList as u };
@@ -1,55 +0,0 @@
1
- import { a as CoinListClient, O as OauthClientErrorReason } from './coinlist-client-B_dJkbwB.js';
2
- import { A as AuthorizationCode, c as CodeVerifier } from './oauth-session-DnKDI5ou.js';
3
-
4
- interface UseCoinListResult {
5
- /**
6
- * Indicates whether the CoinList client has been initialized and ready to use.
7
- * While isReady is false, then the current user state will be `unknown`.
8
- */
9
- isReady: boolean;
10
- coinlist: CoinListClient;
11
- }
12
- declare function useCoinList(): UseCoinListResult;
13
-
14
- /**
15
- * Reasons passed to {@link UseCompleteCoinListOAuthOptions.onFailure} when the
16
- * OAuth callback cannot be completed. Includes PKCE / redirect validation
17
- * errors from {@link CoinListClient.completeOAuth} and a dedicated value when
18
- * {@link UseCompleteCoinListOAuthOptions.postOAuthComplete} fails or rejects.
19
- */
20
- type CompleteCoinListOAuthFailureReason = OauthClientErrorReason | 'complete_request_failed';
21
- interface UseCompleteCoinListOAuthOptions {
22
- /**
23
- * Exchange the authorization code on your backend (e.g. POST to your API).
24
- * Return `true` when the session was established successfully, `false` when
25
- * the request completed but signing in failed. Rejections are treated like
26
- * `false` and reported as {@link CompleteCoinListOAuthFailureReason}
27
- * `"complete_request_failed"`.
28
- */
29
- postOAuthComplete: (payload: {
30
- code: AuthorizationCode;
31
- codeVerifier: CodeVerifier;
32
- }) => Promise<boolean>;
33
- /**
34
- * Called when the user denied access (`error` query parameter), when
35
- * {@link CoinListClient.completeOAuth} fails PKCE/state validation, or when
36
- * {@link UseCompleteCoinListOAuthOptions.postOAuthComplete} fails.
37
- */
38
- onFailure: (reason: CompleteCoinListOAuthFailureReason) => void | Promise<void>;
39
- /** Invoked after {@link UseCompleteCoinListOAuthOptions.postOAuthComplete} succeeds and {@link CoinListClient.init} has refreshed the client session. */
40
- onSuccess: () => void | Promise<void>;
41
- }
42
- /**
43
- * Runs the CoinList OAuth callback once on mount: validates the redirect URL via
44
- * {@link CoinListClient.completeOAuth}, exchanges the code via {@link UseCompleteCoinListOAuthOptions.postOAuthComplete},
45
- * refreshes tokens with {@link CoinListClient.init}, then calls {@link UseCompleteCoinListOAuthOptions.onSuccess}.
46
- *
47
- * Framework-agnostic: reads `window.location` like {@link CoinListClient.completeOAuth}. Supply
48
- * {@link UseCompleteCoinListOAuthOptions.postOAuthComplete}, {@link UseCompleteCoinListOAuthOptions.onFailure},
49
- * and {@link UseCompleteCoinListOAuthOptions.onSuccess} to perform redirects or routing in your app.
50
- *
51
- * Must be used within {@link CoinListProvider}.
52
- */
53
- declare function useCompleteCoinListOAuth(options: UseCompleteCoinListOAuthOptions): void;
54
-
55
- export { type CompleteCoinListOAuthFailureReason as C, type UseCompleteCoinListOAuthOptions as U, useCompleteCoinListOAuth as a, useCoinList as u };