@usethrottle/auth 0.1.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.
@@ -0,0 +1,54 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { ThrottleAuthConfig, ThrottleAuth, AuthSnapshot, ThrottleAccount, ThrottleAuthError, Address, AddressInput, Customer, ProfilePatch, Page, Invoice, Order, PaymentMethod, Subscription } from '../index.cjs';
4
+ export { AuthStatus, AuthStorage, DeviceSession, Session, createAccount, createThrottleAuth, localStorageAdapter, memoryStorage } from '../index.cjs';
5
+
6
+ interface ThrottleAuthProviderProps extends Partial<ThrottleAuthConfig> {
7
+ publishableKey: string;
8
+ /** Inject a pre-built client. Tests use it; merchants sharing one client across roots may too. */
9
+ auth?: ThrottleAuth;
10
+ children: ReactNode;
11
+ }
12
+ interface ContextValue {
13
+ auth: ThrottleAuth;
14
+ account: ThrottleAccount;
15
+ }
16
+ declare function ThrottleAuthProvider(props: ThrottleAuthProviderProps): react_jsx_runtime.JSX.Element;
17
+ declare function useAuthContext(): ContextValue;
18
+ type UseAuthResult = AuthSnapshot & {
19
+ isLoading: boolean;
20
+ isAuthenticated: boolean;
21
+ auth: ThrottleAuth;
22
+ account: ThrottleAccount;
23
+ };
24
+ declare function useAuth(): UseAuthResult;
25
+
26
+ interface Resource<T> {
27
+ data: T;
28
+ isLoading: boolean;
29
+ error: ThrottleAuthError | null;
30
+ refetch(): Promise<void>;
31
+ }
32
+ declare function useCustomer(): Resource<Customer | null> & {
33
+ update(patch: ProfilePatch): Promise<void>;
34
+ };
35
+ declare function useAddresses(): Resource<Address[]> & {
36
+ create(input: AddressInput): Promise<void>;
37
+ update(id: string, patch: Partial<AddressInput>): Promise<void>;
38
+ remove(id: string): Promise<void>;
39
+ };
40
+ declare function useSavedCards(): Resource<PaymentMethod[]> & {
41
+ setDefault(id: string): Promise<void>;
42
+ remove(id: string): Promise<void>;
43
+ };
44
+ declare function useOrders(page?: Page): Resource<Order[]>;
45
+ declare function useInvoices(page?: Page): Resource<Invoice[]>;
46
+ declare function useSubscriptions(page?: Page): Resource<Subscription[]> & {
47
+ cancel(id: string, opts?: {
48
+ atPeriodEnd?: boolean;
49
+ }): Promise<void>;
50
+ pause(id: string): Promise<void>;
51
+ resume(id: string): Promise<void>;
52
+ };
53
+
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 };
@@ -0,0 +1,54 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+ import { ThrottleAuthConfig, ThrottleAuth, AuthSnapshot, ThrottleAccount, ThrottleAuthError, Address, AddressInput, Customer, ProfilePatch, Page, Invoice, Order, PaymentMethod, Subscription } from '../index.js';
4
+ export { AuthStatus, AuthStorage, DeviceSession, Session, createAccount, createThrottleAuth, localStorageAdapter, memoryStorage } from '../index.js';
5
+
6
+ interface ThrottleAuthProviderProps extends Partial<ThrottleAuthConfig> {
7
+ publishableKey: string;
8
+ /** Inject a pre-built client. Tests use it; merchants sharing one client across roots may too. */
9
+ auth?: ThrottleAuth;
10
+ children: ReactNode;
11
+ }
12
+ interface ContextValue {
13
+ auth: ThrottleAuth;
14
+ account: ThrottleAccount;
15
+ }
16
+ declare function ThrottleAuthProvider(props: ThrottleAuthProviderProps): react_jsx_runtime.JSX.Element;
17
+ declare function useAuthContext(): ContextValue;
18
+ type UseAuthResult = AuthSnapshot & {
19
+ isLoading: boolean;
20
+ isAuthenticated: boolean;
21
+ auth: ThrottleAuth;
22
+ account: ThrottleAccount;
23
+ };
24
+ declare function useAuth(): UseAuthResult;
25
+
26
+ interface Resource<T> {
27
+ data: T;
28
+ isLoading: boolean;
29
+ error: ThrottleAuthError | null;
30
+ refetch(): Promise<void>;
31
+ }
32
+ declare function useCustomer(): Resource<Customer | null> & {
33
+ update(patch: ProfilePatch): Promise<void>;
34
+ };
35
+ declare function useAddresses(): Resource<Address[]> & {
36
+ create(input: AddressInput): Promise<void>;
37
+ update(id: string, patch: Partial<AddressInput>): Promise<void>;
38
+ remove(id: string): Promise<void>;
39
+ };
40
+ declare function useSavedCards(): Resource<PaymentMethod[]> & {
41
+ setDefault(id: string): Promise<void>;
42
+ remove(id: string): Promise<void>;
43
+ };
44
+ declare function useOrders(page?: Page): Resource<Order[]>;
45
+ declare function useInvoices(page?: Page): Resource<Invoice[]>;
46
+ declare function useSubscriptions(page?: Page): Resource<Subscription[]> & {
47
+ cancel(id: string, opts?: {
48
+ atPeriodEnd?: boolean;
49
+ }): Promise<void>;
50
+ pause(id: string): Promise<void>;
51
+ resume(id: string): Promise<void>;
52
+ };
53
+
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 };
@@ -0,0 +1,145 @@
1
+ import "../chunk-ZMNCURDE.js";
2
+ import {
3
+ ThrottleAuthProvider,
4
+ useAuth,
5
+ useAuthContext
6
+ } from "../chunk-YHIGTY64.js";
7
+ import {
8
+ ThrottleAuthError,
9
+ createAccount,
10
+ createThrottleAuth,
11
+ localStorageAdapter,
12
+ memoryStorage
13
+ } from "../chunk-NQU7HM23.js";
14
+
15
+ // src/react/hooks.ts
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
+ }
129
+ export {
130
+ ThrottleAuthError,
131
+ ThrottleAuthProvider,
132
+ createAccount,
133
+ createThrottleAuth,
134
+ localStorageAdapter,
135
+ memoryStorage,
136
+ useAddresses,
137
+ useAuth,
138
+ useAuthContext,
139
+ useCustomer,
140
+ useInvoices,
141
+ useOrders,
142
+ useSavedCards,
143
+ useSubscriptions
144
+ };
145
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/react/hooks.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { ThrottleAuthError } from '../errors';\nimport type { Address, AddressInput, Customer, Invoice, Order, PaymentMethod, ProfilePatch, Subscription } from '../types';\nimport type { Page } from '../account';\nimport { useAuth } from './context';\n\nexport interface Resource<T> {\n data: T;\n isLoading: boolean;\n error: ThrottleAuthError | null;\n refetch(): Promise<void>;\n}\n\nfunction asError(err: unknown): ThrottleAuthError {\n if (err instanceof ThrottleAuthError) return err;\n const anyErr = err as any;\n return new ThrottleAuthError({\n code: anyErr?.code ?? 'request_failed',\n message: anyErr?.message ?? String(err),\n statusCode: anyErr?.statusCode ?? 0,\n });\n}\n\n/**\n * One fetch-on-auth-change primitive behind every resource hook. `emailVerified`\n * is a dependency on purpose: verifying lifts the claim cutoff, and lists that\n * were legitimately empty a moment ago are not empty any more.\n */\nfunction useResource<T>(empty: T, load: () => Promise<T>, deps: unknown[]): Resource<T> {\n const { status, emailVerified } = useAuth();\n const [data, setData] = useState<T>(empty);\n const [isLoading, setIsLoading] = useState(status === 'loading');\n const [error, setError] = useState<ThrottleAuthError | null>(null);\n const gen = useRef(0);\n const alive = useRef(true);\n\n useEffect(() => {\n // Set on mount, not only cleared on unmount: React StrictMode mounts,\n // unmounts and remounts in development, and a ref that is only ever set\n // to false would silently discard every response for the rest of the\n // component's life.\n alive.current = true;\n return () => { alive.current = false; gen.current++; };\n }, []);\n\n const refetch = useCallback(async () => {\n const mine = ++gen.current;\n setIsLoading(true);\n try {\n const next = await load();\n if (!alive.current || gen.current !== mine) return;\n setData(next);\n setError(null);\n } catch (err) {\n if (!alive.current || gen.current !== mine) return;\n setError(asError(err));\n } finally {\n if (alive.current && gen.current === mine) setIsLoading(false);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n useEffect(() => {\n if (status !== 'authenticated') {\n gen.current++; // abandon anything in flight\n setData(empty);\n setError(null);\n setIsLoading(status === 'loading');\n return;\n }\n void refetch();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [status, emailVerified, refetch]);\n\n return { data, isLoading, error, refetch };\n}\n\nexport function useCustomer(): Resource<Customer | null> & { update(patch: ProfilePatch): Promise<void> } {\n const { account } = useAuth();\n const res = useResource<Customer | null>(null, () => account.getProfile(), [account]);\n const update = useCallback(async (patch: ProfilePatch) => {\n await account.updateProfile(patch);\n await res.refetch();\n }, [account, res]);\n return { ...res, update };\n}\n\nexport function useAddresses(): Resource<Address[]> & {\n create(input: AddressInput): Promise<void>;\n update(id: string, patch: Partial<AddressInput>): Promise<void>;\n remove(id: string): Promise<void>;\n} {\n const { account } = useAuth();\n const res = useResource<Address[]>([], () => account.listAddresses(), [account]);\n const after = async (p: Promise<unknown>) => { await p; await res.refetch(); };\n return {\n ...res,\n create: (input) => after(account.createAddress(input)),\n update: (id, patch) => after(account.updateAddress(id, patch)),\n remove: (id) => after(account.deleteAddress(id)),\n };\n}\n\nexport function useSavedCards(): Resource<PaymentMethod[]> & {\n setDefault(id: string): Promise<void>;\n remove(id: string): Promise<void>;\n} {\n const { account } = useAuth();\n const res = useResource<PaymentMethod[]>([], () => account.listPaymentMethods(), [account]);\n const after = async (p: Promise<unknown>) => { await p; await res.refetch(); };\n return {\n ...res,\n setDefault: (id) => after(account.setDefaultPaymentMethod(id)),\n remove: (id) => after(account.deletePaymentMethod(id)),\n };\n}\n\nexport function useOrders(page?: Page): Resource<Order[]> {\n const { account } = useAuth();\n return useResource<Order[]>([], () => account.listOrders(page), [account, page?.cursor, page?.limit]);\n}\n\nexport function useInvoices(page?: Page): Resource<Invoice[]> {\n const { account } = useAuth();\n return useResource<Invoice[]>([], () => account.listInvoices(page), [account, page?.cursor, page?.limit]);\n}\n\nexport function useSubscriptions(page?: Page): Resource<Subscription[]> & {\n cancel(id: string, opts?: { atPeriodEnd?: boolean }): Promise<void>;\n pause(id: string): Promise<void>;\n resume(id: string): Promise<void>;\n} {\n const { account } = useAuth();\n const res = useResource<Subscription[]>([], () => account.listSubscriptions(page),\n [account, page?.cursor, page?.limit]);\n const after = async (p: Promise<unknown>) => { await p; await res.refetch(); };\n return {\n ...res,\n cancel: (id, opts) => after(account.cancelSubscription(id, opts)),\n pause: (id) => after(account.pauseSubscription(id)),\n resume: (id) => after(account.resumeSubscription(id)),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AAazD,SAAS,QAAQ,KAAiC;AAChD,MAAI,eAA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AACF;AAEO,SAAS,UAAU,MAAgC;AACxD,QAAM,EAAE,QAAQ,IAAI,QAAQ;AAC5B,SAAO,YAAqB,CAAC,GAAG,MAAM,QAAQ,WAAW,IAAI,GAAG,CAAC,SAAS,MAAM,QAAQ,MAAM,KAAK,CAAC;AACtG;AAEO,SAAS,YAAY,MAAkC;AAC5D,QAAM,EAAE,QAAQ,IAAI,QAAQ;AAC5B,SAAO,YAAuB,CAAC,GAAG,MAAM,QAAQ,aAAa,IAAI,GAAG,CAAC,SAAS,MAAM,QAAQ,MAAM,KAAK,CAAC;AAC1G;AAEO,SAAS,iBAAiB,MAI/B;AACA,QAAM,EAAE,QAAQ,IAAI,QAAQ;AAC5B,QAAM,MAAM;AAAA,IAA4B,CAAC;AAAA,IAAG,MAAM,QAAQ,kBAAkB,IAAI;AAAA,IAC9E,CAAC,SAAS,MAAM,QAAQ,MAAM,KAAK;AAAA,EAAC;AACtC,QAAM,QAAQ,OAAO,MAAwB;AAAE,UAAM;AAAG,UAAM,IAAI,QAAQ;AAAA,EAAG;AAC7E,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ,CAAC,IAAI,SAAS,MAAM,QAAQ,mBAAmB,IAAI,IAAI,CAAC;AAAA,IAChE,OAAO,CAAC,OAAO,MAAM,QAAQ,kBAAkB,EAAE,CAAC;AAAA,IAClD,QAAQ,CAAC,OAAO,MAAM,QAAQ,mBAAmB,EAAE,CAAC;AAAA,EACtD;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@usethrottle/auth",
3
+ "version": "0.1.0",
4
+ "description": "Buyer authentication for Throttle storefronts — headless core, React hooks, and drop-in forms.",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "files": ["dist", "README.md", "CLAUDE.md"],
10
+ "exports": {
11
+ ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" },
12
+ "./react": { "types": "./dist/react/index.d.ts", "import": "./dist/react/index.js", "require": "./dist/react/index.cjs" },
13
+ "./forms": { "types": "./dist/react/forms/index.d.ts", "import": "./dist/react/forms/index.js", "require": "./dist/react/forms/index.cjs" }
14
+ },
15
+ "scripts": {
16
+ "build": "tsup",
17
+ "dev": "tsup --watch",
18
+ "test": "vitest run",
19
+ "typecheck": "tsc --noEmit"
20
+ },
21
+ "peerDependencies": { "react": ">=18", "react-dom": ">=18" },
22
+ "peerDependenciesMeta": { "react": { "optional": true }, "react-dom": { "optional": true } },
23
+ "devDependencies": {
24
+ "@testing-library/react": "^16.1.0",
25
+ "@types/react": "^19.1.0",
26
+ "@vitejs/plugin-react": "^4.3.4",
27
+ "jsdom": "^25.0.1",
28
+ "react": "^19.1.0",
29
+ "react-dom": "^19.1.0",
30
+ "tsup": "^8.0.0",
31
+ "typescript": "^5.7.0",
32
+ "vitest": "^2.1.9"
33
+ },
34
+ "publishConfig": { "access": "public" },
35
+ "engines": { "node": ">=20" }
36
+ }