@usethrottle/auth 0.1.1 → 0.2.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/CLAUDE.md +25 -0
- package/README.md +307 -1
- package/dist/chunk-AIXBUDOT.js +50 -0
- package/dist/chunk-AIXBUDOT.js.map +1 -0
- package/dist/chunk-HGBAIM6B.js +140 -0
- package/dist/chunk-HGBAIM6B.js.map +1 -0
- package/dist/{chunk-OYNGTNOS.js → chunk-SZ427BQ3.js} +54 -6
- package/dist/chunk-SZ427BQ3.js.map +1 -0
- package/dist/index.cjs +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +377 -8
- package/dist/index.js.map +1 -1
- package/dist/react/components/index.cjs +4558 -0
- package/dist/react/components/index.cjs.map +1 -0
- package/dist/react/components/index.d.cts +735 -0
- package/dist/react/components/index.d.ts +735 -0
- package/dist/react/components/index.js +3918 -0
- package/dist/react/components/index.js.map +1 -0
- package/dist/react/forms/index.cjs +3 -0
- package/dist/react/forms/index.cjs.map +1 -1
- package/dist/react/forms/index.js +5 -46
- package/dist/react/forms/index.js.map +1 -1
- package/dist/react/index.cjs +22 -4
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +278 -3
- package/dist/react/index.d.ts +278 -3
- package/dist/react/index.js +17 -122
- package/dist/react/index.js.map +1 -1
- package/dist/styles.css +422 -0
- package/package.json +5 -2
- package/dist/chunk-IJ3DNMNG.js +0 -49
- package/dist/chunk-IJ3DNMNG.js.map +0 -1
- package/dist/chunk-OYNGTNOS.js.map +0 -1
- package/dist/chunk-ZMNCURDE.js +0 -1
- package/dist/chunk-ZMNCURDE.js.map +0 -1
package/dist/react/index.d.ts
CHANGED
|
@@ -1,7 +1,252 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
interface Customer {
|
|
5
|
+
id: string;
|
|
6
|
+
email: string;
|
|
7
|
+
emailVerified: boolean;
|
|
8
|
+
firstName?: string | null;
|
|
9
|
+
lastName?: string | null;
|
|
10
|
+
phone?: string | null;
|
|
11
|
+
company?: string | null;
|
|
12
|
+
acceptsMarketing?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface Session {
|
|
15
|
+
accessToken: string;
|
|
16
|
+
expiresAt: string;
|
|
17
|
+
refreshToken: string;
|
|
18
|
+
customer: Customer;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Defined here rather than in `storage.ts` so `ThrottleAuthConfig` can name it
|
|
22
|
+
* without importing a module that does not exist until Task 2. `storage.ts`
|
|
23
|
+
* imports and re-exports it.
|
|
24
|
+
*/
|
|
25
|
+
interface AuthStorage {
|
|
26
|
+
get(key: string): string | null | Promise<string | null>;
|
|
27
|
+
set(key: string, value: string): void | Promise<void>;
|
|
28
|
+
remove(key: string): void | Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
interface ThrottleAuthConfig {
|
|
31
|
+
publishableKey: string;
|
|
32
|
+
baseUrl?: string;
|
|
33
|
+
storage?: AuthStorage;
|
|
34
|
+
/** Called when a route needs a step-up proof. Return the buyer's password, or null to cancel. */
|
|
35
|
+
onStepUpRequired?: () => Promise<string | null>;
|
|
36
|
+
}
|
|
37
|
+
interface ProfilePatch {
|
|
38
|
+
firstName?: string;
|
|
39
|
+
lastName?: string;
|
|
40
|
+
phone?: string;
|
|
41
|
+
company?: string | null;
|
|
42
|
+
acceptsMarketing?: boolean;
|
|
43
|
+
}
|
|
44
|
+
interface AddressInput {
|
|
45
|
+
label?: string;
|
|
46
|
+
firstName?: string;
|
|
47
|
+
lastName?: string;
|
|
48
|
+
company?: string;
|
|
49
|
+
addressLine1: string;
|
|
50
|
+
addressLine2?: string;
|
|
51
|
+
city: string;
|
|
52
|
+
stateProvince?: string;
|
|
53
|
+
postalCode?: string;
|
|
54
|
+
countryCode: string;
|
|
55
|
+
phone?: string;
|
|
56
|
+
isDefault?: boolean;
|
|
57
|
+
}
|
|
58
|
+
interface Address {
|
|
59
|
+
id: string;
|
|
60
|
+
label: string | null;
|
|
61
|
+
firstName: string | null;
|
|
62
|
+
lastName: string | null;
|
|
63
|
+
company: string | null;
|
|
64
|
+
addressLine1: string;
|
|
65
|
+
addressLine2: string | null;
|
|
66
|
+
city: string;
|
|
67
|
+
stateProvince: string | null;
|
|
68
|
+
postalCode: string | null;
|
|
69
|
+
countryCode: string;
|
|
70
|
+
phone: string | null;
|
|
71
|
+
isDefault: boolean;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
updatedAt: string;
|
|
74
|
+
}
|
|
75
|
+
interface PaymentMethod {
|
|
76
|
+
id: string;
|
|
77
|
+
methodType: string;
|
|
78
|
+
cardBrand: string | null;
|
|
79
|
+
cardLastFour: string | null;
|
|
80
|
+
cardExpMonth: number | null;
|
|
81
|
+
cardExpYear: number | null;
|
|
82
|
+
isDefault: boolean;
|
|
83
|
+
createdAt: string;
|
|
84
|
+
}
|
|
85
|
+
interface Order {
|
|
86
|
+
id: string;
|
|
87
|
+
orderNumber: string;
|
|
88
|
+
status: string;
|
|
89
|
+
type: string;
|
|
90
|
+
paymentStatus: string;
|
|
91
|
+
currency: string;
|
|
92
|
+
subtotal: number;
|
|
93
|
+
taxTotal: number;
|
|
94
|
+
discountTotal: number;
|
|
95
|
+
shippingTotal: number;
|
|
96
|
+
total: number;
|
|
97
|
+
buyerVatNumber: string | null;
|
|
98
|
+
taxReverseCharge: boolean;
|
|
99
|
+
billingAddress: unknown | null;
|
|
100
|
+
shippingAddress: unknown | null;
|
|
101
|
+
discountCode: string | null;
|
|
102
|
+
subscriptionId: string | null;
|
|
103
|
+
cancelledAt: string | null;
|
|
104
|
+
completedAt: string | null;
|
|
105
|
+
closedAt: string | null;
|
|
106
|
+
createdAt: string;
|
|
107
|
+
updatedAt: string;
|
|
108
|
+
}
|
|
109
|
+
interface OrderLineItem {
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
description: string | null;
|
|
113
|
+
quantity: number;
|
|
114
|
+
/** Integer minor units, like every other amount on the wire. */
|
|
115
|
+
unitPrice: number;
|
|
116
|
+
subtotal: number;
|
|
117
|
+
taxAmount: number;
|
|
118
|
+
discountAmount: number;
|
|
119
|
+
total: number;
|
|
120
|
+
imageUrl: string | null;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* What `getOrder` returns. Deliberately NOT folded into `Order`: the list route
|
|
124
|
+
* does not load line items, so a required `lineItems` on `Order` would be a
|
|
125
|
+
* promise the list response cannot keep.
|
|
126
|
+
*/
|
|
127
|
+
interface OrderDetail extends Order {
|
|
128
|
+
lineItems: OrderLineItem[];
|
|
129
|
+
}
|
|
130
|
+
interface Invoice {
|
|
131
|
+
id: string;
|
|
132
|
+
number: string;
|
|
133
|
+
status: string;
|
|
134
|
+
currency: string;
|
|
135
|
+
subtotal: number;
|
|
136
|
+
taxTotal: number;
|
|
137
|
+
shippingTotal: number;
|
|
138
|
+
discountTotal: number;
|
|
139
|
+
total: number;
|
|
140
|
+
amountRefunded: number;
|
|
141
|
+
issuedAt: string;
|
|
142
|
+
dueAt: string | null;
|
|
143
|
+
periodStart: string | null;
|
|
144
|
+
periodEnd: string | null;
|
|
145
|
+
createdAt: string;
|
|
146
|
+
updatedAt: string;
|
|
147
|
+
}
|
|
148
|
+
interface Subscription {
|
|
149
|
+
id: string;
|
|
150
|
+
status: string;
|
|
151
|
+
planReference: string;
|
|
152
|
+
planName: string | null;
|
|
153
|
+
interval: string;
|
|
154
|
+
amount: number;
|
|
155
|
+
quantity: number;
|
|
156
|
+
currency: string;
|
|
157
|
+
currentPeriodStart: string;
|
|
158
|
+
currentPeriodEnd: string;
|
|
159
|
+
trialEnd: string | null;
|
|
160
|
+
cancelledAt: string | null;
|
|
161
|
+
cancelAtPeriodEnd: boolean;
|
|
162
|
+
pendingPlanReference: string | null;
|
|
163
|
+
pendingPlanName: string | null;
|
|
164
|
+
pendingInterval: string | null;
|
|
165
|
+
pendingQuantity: number | null;
|
|
166
|
+
pausedAt: string | null;
|
|
167
|
+
lastPaymentAt: string | null;
|
|
168
|
+
createdAt: string;
|
|
169
|
+
updatedAt: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
type AuthStatus = 'loading' | 'authenticated' | 'unauthenticated';
|
|
173
|
+
interface AuthSnapshot {
|
|
174
|
+
status: AuthStatus;
|
|
175
|
+
customer: Customer | null;
|
|
176
|
+
/**
|
|
177
|
+
* False here does NOT only mean "we emailed them and they have not clicked".
|
|
178
|
+
* While it is false the API may also be withholding pre-existing account
|
|
179
|
+
* data behind the claim cutoff — empty order lists and a 403 on `PATCH /me`
|
|
180
|
+
* are expected, not broken. See the plan header.
|
|
181
|
+
*/
|
|
182
|
+
emailVerified: boolean;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
interface DeviceSession {
|
|
186
|
+
id: string;
|
|
187
|
+
userAgent: string | null;
|
|
188
|
+
ipPrefix: string | null;
|
|
189
|
+
createdAt: string;
|
|
190
|
+
lastUsedAt: string;
|
|
191
|
+
current: boolean;
|
|
192
|
+
}
|
|
193
|
+
interface ThrottleAuth {
|
|
194
|
+
register(email: string, password: string): Promise<{
|
|
195
|
+
status: 'active' | 'pending';
|
|
196
|
+
}>;
|
|
197
|
+
signIn(email: string, password: string): Promise<void>;
|
|
198
|
+
signOut(): Promise<void>;
|
|
199
|
+
signOutEverywhere(): Promise<void>;
|
|
200
|
+
restore(): Promise<void>;
|
|
201
|
+
getSnapshot(): AuthSnapshot;
|
|
202
|
+
subscribe(fn: (s: AuthSnapshot) => void): () => void;
|
|
203
|
+
stepUp(password: string): Promise<void>;
|
|
204
|
+
call<T = any>(method: string, path: string, body?: unknown): Promise<T>;
|
|
205
|
+
verifyEmail(token: string): Promise<void>;
|
|
206
|
+
resendVerification(): Promise<void>;
|
|
207
|
+
forgotPassword(email: string): Promise<void>;
|
|
208
|
+
resetPassword(token: string, password: string): Promise<void>;
|
|
209
|
+
changePassword(password: string): Promise<void>;
|
|
210
|
+
listSessions(): Promise<DeviceSession[]>;
|
|
211
|
+
revokeSession(id: string): Promise<void>;
|
|
212
|
+
}
|
|
213
|
+
declare function createThrottleAuth(config: ThrottleAuthConfig): ThrottleAuth;
|
|
214
|
+
|
|
215
|
+
interface Page {
|
|
216
|
+
cursor?: string;
|
|
217
|
+
limit?: number;
|
|
218
|
+
}
|
|
219
|
+
interface ThrottleAccount {
|
|
220
|
+
getProfile(): Promise<Customer>;
|
|
221
|
+
updateProfile(patch: ProfilePatch): Promise<Customer>;
|
|
222
|
+
listAddresses(): Promise<Address[]>;
|
|
223
|
+
createAddress(input: AddressInput): Promise<Address>;
|
|
224
|
+
updateAddress(id: string, patch: Partial<AddressInput>): Promise<Address>;
|
|
225
|
+
deleteAddress(id: string): Promise<void>;
|
|
226
|
+
listPaymentMethods(): Promise<PaymentMethod[]>;
|
|
227
|
+
setDefaultPaymentMethod(id: string): Promise<PaymentMethod>;
|
|
228
|
+
deletePaymentMethod(id: string): Promise<void>;
|
|
229
|
+
listOrders(page?: Page): Promise<Order[]>;
|
|
230
|
+
getOrder(id: string): Promise<OrderDetail>;
|
|
231
|
+
listInvoices(page?: Page): Promise<Invoice[]>;
|
|
232
|
+
getInvoice(id: string): Promise<Invoice>;
|
|
233
|
+
/** A 600-second signed URL. Fetch it on click — it expires. */
|
|
234
|
+
getInvoicePdfUrl(id: string): Promise<{
|
|
235
|
+
url: string;
|
|
236
|
+
}>;
|
|
237
|
+
listSubscriptions(page?: Page): Promise<Subscription[]>;
|
|
238
|
+
getSubscription(id: string): Promise<Subscription>;
|
|
239
|
+
cancelSubscription(id: string, opts?: {
|
|
240
|
+
atPeriodEnd?: boolean;
|
|
241
|
+
}): Promise<Subscription>;
|
|
242
|
+
pauseSubscription(id: string): Promise<Subscription>;
|
|
243
|
+
resumeSubscription(id: string): Promise<Subscription>;
|
|
244
|
+
claimCart(cartId: string): Promise<{
|
|
245
|
+
cartId: string;
|
|
246
|
+
customerId: string;
|
|
247
|
+
}>;
|
|
248
|
+
}
|
|
249
|
+
declare function createAccount(auth: ThrottleAuth): ThrottleAccount;
|
|
5
250
|
|
|
6
251
|
interface ThrottleAuthProviderProps extends Partial<ThrottleAuthConfig> {
|
|
7
252
|
publishableKey: string;
|
|
@@ -23,6 +268,20 @@ type UseAuthResult = AuthSnapshot & {
|
|
|
23
268
|
};
|
|
24
269
|
declare function useAuth(): UseAuthResult;
|
|
25
270
|
|
|
271
|
+
declare class ThrottleAuthError extends Error {
|
|
272
|
+
readonly code: string;
|
|
273
|
+
readonly statusCode: number;
|
|
274
|
+
readonly retryAfter?: number;
|
|
275
|
+
readonly details?: unknown;
|
|
276
|
+
constructor(args: {
|
|
277
|
+
code: string;
|
|
278
|
+
message: string;
|
|
279
|
+
statusCode: number;
|
|
280
|
+
retryAfter?: number;
|
|
281
|
+
details?: unknown;
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
26
285
|
interface Resource<T> {
|
|
27
286
|
data: T;
|
|
28
287
|
isLoading: boolean;
|
|
@@ -50,5 +309,21 @@ declare function useSubscriptions(page?: Page): Resource<Subscription[]> & {
|
|
|
50
309
|
pause(id: string): Promise<void>;
|
|
51
310
|
resume(id: string): Promise<void>;
|
|
52
311
|
};
|
|
312
|
+
/**
|
|
313
|
+
* Single-resource reads for the detail views. A `null` id means "nothing
|
|
314
|
+
* selected" and must not call the API — `useResource` still runs, so the
|
|
315
|
+
* loader resolves to null rather than being skipped, which keeps the
|
|
316
|
+
* loading/error shape identical whether or not an id is present.
|
|
317
|
+
*/
|
|
318
|
+
declare function useOrder(id: string | null): Resource<OrderDetail | null>;
|
|
319
|
+
declare function useInvoice(id: string | null): Resource<Invoice | null>;
|
|
320
|
+
|
|
321
|
+
declare function memoryStorage(): AuthStorage;
|
|
322
|
+
/**
|
|
323
|
+
* localStorage when it works, memory when it does not. Safari private mode,
|
|
324
|
+
* hardened browser settings and server-side rendering all make localStorage
|
|
325
|
+
* either absent or throwing; none of them may take the storefront down.
|
|
326
|
+
*/
|
|
327
|
+
declare function localStorageAdapter(): AuthStorage;
|
|
53
328
|
|
|
54
|
-
export { Address, AddressInput, AuthSnapshot, Customer, Invoice, Order, Page, PaymentMethod, ProfilePatch, type Resource, Subscription, ThrottleAccount, ThrottleAuth, ThrottleAuthConfig, ThrottleAuthError, ThrottleAuthProvider, type ThrottleAuthProviderProps, type UseAuthResult, useAddresses, useAuth, useAuthContext, useCustomer, useInvoices, useOrders, useSavedCards, useSubscriptions };
|
|
329
|
+
export { type Address, type AddressInput, type AuthSnapshot, type AuthStatus, type AuthStorage, type Customer, type DeviceSession, type Invoice, type Order, type Page, type PaymentMethod, type ProfilePatch, type Resource, type Session, type Subscription, type ThrottleAccount, type ThrottleAuth, type ThrottleAuthConfig, ThrottleAuthError, ThrottleAuthProvider, type ThrottleAuthProviderProps, type UseAuthResult, createAccount, createThrottleAuth, localStorageAdapter, memoryStorage, useAddresses, useAuth, useAuthContext, useCustomer, useInvoice, useInvoices, useOrder, useOrders, useSavedCards, useSubscriptions };
|
package/dist/react/index.js
CHANGED
|
@@ -1,131 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
useAddresses,
|
|
4
|
+
useCustomer,
|
|
5
|
+
useInvoice,
|
|
6
|
+
useInvoices,
|
|
7
|
+
useOrder,
|
|
8
|
+
useOrders,
|
|
9
|
+
useSavedCards,
|
|
10
|
+
useSubscriptions
|
|
11
|
+
} from "../chunk-HGBAIM6B.js";
|
|
7
12
|
import {
|
|
8
13
|
ThrottleAuthError,
|
|
14
|
+
ThrottleAuthProvider,
|
|
9
15
|
createAccount,
|
|
10
16
|
createThrottleAuth,
|
|
11
17
|
localStorageAdapter,
|
|
12
|
-
memoryStorage
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
17
|
-
function asError(err) {
|
|
18
|
-
if (err instanceof ThrottleAuthError) return err;
|
|
19
|
-
const anyErr = err;
|
|
20
|
-
return new ThrottleAuthError({
|
|
21
|
-
code: anyErr?.code ?? "request_failed",
|
|
22
|
-
message: anyErr?.message ?? String(err),
|
|
23
|
-
statusCode: anyErr?.statusCode ?? 0
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function useResource(empty, load, deps) {
|
|
27
|
-
const { status, emailVerified } = useAuth();
|
|
28
|
-
const [data, setData] = useState(empty);
|
|
29
|
-
const [isLoading, setIsLoading] = useState(status === "loading");
|
|
30
|
-
const [error, setError] = useState(null);
|
|
31
|
-
const gen = useRef(0);
|
|
32
|
-
const alive = useRef(true);
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
alive.current = true;
|
|
35
|
-
return () => {
|
|
36
|
-
alive.current = false;
|
|
37
|
-
gen.current++;
|
|
38
|
-
};
|
|
39
|
-
}, []);
|
|
40
|
-
const refetch = useCallback(async () => {
|
|
41
|
-
const mine = ++gen.current;
|
|
42
|
-
setIsLoading(true);
|
|
43
|
-
try {
|
|
44
|
-
const next = await load();
|
|
45
|
-
if (!alive.current || gen.current !== mine) return;
|
|
46
|
-
setData(next);
|
|
47
|
-
setError(null);
|
|
48
|
-
} catch (err) {
|
|
49
|
-
if (!alive.current || gen.current !== mine) return;
|
|
50
|
-
setError(asError(err));
|
|
51
|
-
} finally {
|
|
52
|
-
if (alive.current && gen.current === mine) setIsLoading(false);
|
|
53
|
-
}
|
|
54
|
-
}, deps);
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (status !== "authenticated") {
|
|
57
|
-
gen.current++;
|
|
58
|
-
setData(empty);
|
|
59
|
-
setError(null);
|
|
60
|
-
setIsLoading(status === "loading");
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
void refetch();
|
|
64
|
-
}, [status, emailVerified, refetch]);
|
|
65
|
-
return { data, isLoading, error, refetch };
|
|
66
|
-
}
|
|
67
|
-
function useCustomer() {
|
|
68
|
-
const { account } = useAuth();
|
|
69
|
-
const res = useResource(null, () => account.getProfile(), [account]);
|
|
70
|
-
const update = useCallback(async (patch) => {
|
|
71
|
-
await account.updateProfile(patch);
|
|
72
|
-
await res.refetch();
|
|
73
|
-
}, [account, res]);
|
|
74
|
-
return { ...res, update };
|
|
75
|
-
}
|
|
76
|
-
function useAddresses() {
|
|
77
|
-
const { account } = useAuth();
|
|
78
|
-
const res = useResource([], () => account.listAddresses(), [account]);
|
|
79
|
-
const after = async (p) => {
|
|
80
|
-
await p;
|
|
81
|
-
await res.refetch();
|
|
82
|
-
};
|
|
83
|
-
return {
|
|
84
|
-
...res,
|
|
85
|
-
create: (input) => after(account.createAddress(input)),
|
|
86
|
-
update: (id, patch) => after(account.updateAddress(id, patch)),
|
|
87
|
-
remove: (id) => after(account.deleteAddress(id))
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
function useSavedCards() {
|
|
91
|
-
const { account } = useAuth();
|
|
92
|
-
const res = useResource([], () => account.listPaymentMethods(), [account]);
|
|
93
|
-
const after = async (p) => {
|
|
94
|
-
await p;
|
|
95
|
-
await res.refetch();
|
|
96
|
-
};
|
|
97
|
-
return {
|
|
98
|
-
...res,
|
|
99
|
-
setDefault: (id) => after(account.setDefaultPaymentMethod(id)),
|
|
100
|
-
remove: (id) => after(account.deletePaymentMethod(id))
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
function useOrders(page) {
|
|
104
|
-
const { account } = useAuth();
|
|
105
|
-
return useResource([], () => account.listOrders(page), [account, page?.cursor, page?.limit]);
|
|
106
|
-
}
|
|
107
|
-
function useInvoices(page) {
|
|
108
|
-
const { account } = useAuth();
|
|
109
|
-
return useResource([], () => account.listInvoices(page), [account, page?.cursor, page?.limit]);
|
|
110
|
-
}
|
|
111
|
-
function useSubscriptions(page) {
|
|
112
|
-
const { account } = useAuth();
|
|
113
|
-
const res = useResource(
|
|
114
|
-
[],
|
|
115
|
-
() => account.listSubscriptions(page),
|
|
116
|
-
[account, page?.cursor, page?.limit]
|
|
117
|
-
);
|
|
118
|
-
const after = async (p) => {
|
|
119
|
-
await p;
|
|
120
|
-
await res.refetch();
|
|
121
|
-
};
|
|
122
|
-
return {
|
|
123
|
-
...res,
|
|
124
|
-
cancel: (id, opts) => after(account.cancelSubscription(id, opts)),
|
|
125
|
-
pause: (id) => after(account.pauseSubscription(id)),
|
|
126
|
-
resume: (id) => after(account.resumeSubscription(id))
|
|
127
|
-
};
|
|
128
|
-
}
|
|
18
|
+
memoryStorage,
|
|
19
|
+
useAuth,
|
|
20
|
+
useAuthContext
|
|
21
|
+
} from "../chunk-SZ427BQ3.js";
|
|
129
22
|
export {
|
|
130
23
|
ThrottleAuthError,
|
|
131
24
|
ThrottleAuthProvider,
|
|
@@ -137,7 +30,9 @@ export {
|
|
|
137
30
|
useAuth,
|
|
138
31
|
useAuthContext,
|
|
139
32
|
useCustomer,
|
|
33
|
+
useInvoice,
|
|
140
34
|
useInvoices,
|
|
35
|
+
useOrder,
|
|
141
36
|
useOrders,
|
|
142
37
|
useSavedCards,
|
|
143
38
|
useSubscriptions
|
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|